12inline pg_exception::pg_exception(::MemoryContext mcxt) : mcxt(mcxt) {
13 ::CurrentMemoryContext = error_cxt =
14 memory_context(std::move(alloc_set_memory_context(top_memory_context())));
15 error = ffi_guard{::CopyErrorData}();
16 ::CurrentMemoryContext = mcxt;
17 ffi_guard{::FlushErrorState}();
20inline pg_exception::~pg_exception() { memory_context(error_cxt).delete_context(); }