Content-Length: 304182 | pFad | http://github.com/postgrespro/postgres_cluster/commit/542c83f0eb426b9aaedc936b233466c8a11bb687

A9 switch from error context · postgrespro/postgres_cluster@542c83f · GitHub
Skip to content

Commit 542c83f

Browse files
author
Vladimir Ershov
committed
switch from error context
1 parent 695a5d0 commit 542c83f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/scheduler_spi_utils.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ spi_response_t *execute_spi_sql_with_args(MemoryContext ctx, const char *sql, in
498498
ResourceOwner oldowner = CurrentResourceOwner;
499499
spi_response_t *rv = NULL;
500500
MemoryContext old = CurrentMemoryContext;
501+
MemoryContext pe;
501502

502503
if(!ctx) ctx = SchedulerWorkerContext;
503504

@@ -523,7 +524,9 @@ spi_response_t *execute_spi_sql_with_args(MemoryContext ctx, const char *sql, in
523524
}
524525
PG_CATCH();
525526
{
527+
pe = MemoryContextSwitchTo(ctx);
526528
edata = CopyErrorData();
529+
MemoryContextSwitchTo(pe);
527530
if(edata->message)
528531
{
529532
rv = __error_spi_resp(ctx, ret, edata->message);
@@ -600,6 +603,7 @@ spi_response_t *execute_spi_params_prepared(MemoryContext ctx, const char *sql,
600603
ResourceOwner oldowner = CurrentResourceOwner;
601604
spi_response_t *rv;
602605
MemoryContext old = CurrentMemoryContext;
606+
MemoryContext pe;
603607

604608
if(!ctx) ctx = SchedulerWorkerContext;
605609

@@ -637,7 +641,9 @@ spi_response_t *execute_spi_params_prepared(MemoryContext ctx, const char *sql,
637641
}
638642
PG_CATCH();
639643
{
644+
pe = MemoryContextSwitchTo(ctx);
640645
edata = CopyErrorData();
646+
MemoryContextSwitchTo(pe);
641647
if(edata->message)
642648
{
643649
rv = __error_spi_resp(ctx, ret, edata->message);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/542c83f0eb426b9aaedc936b233466c8a11bb687

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy