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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy