12pg_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_guarded(::CopyErrorData)();
16 ::CurrentMemoryContext = mcxt;
17 ffi_guarded(::FlushErrorState)();
20pg_exception::~pg_exception() { memory_context(error_cxt).delete_context(); }