Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit29fa051

Browse files
committed
When executing a list of queries derived from rule expansion,
_SPI_execute_plan's return code should reflect the type of the querythat is marked canSetTag, not necessarily the last one in the list.This is arguably a bug fix, but I'm hesitant to back-patch it becauseit's the sort of subtle change that might break someone's code, and it'sbest not to do that kind of thing in point releases.
1 parentc859294 commit29fa051

File tree

1 file changed

+12
-7
lines changed
  • src/backend/executor

1 file changed

+12
-7
lines changed

‎src/backend/executor/spi.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.155 2006/08/12 20:05:55 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.156 2006/08/14 13:40:18 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1306,7 +1306,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
13061306
Snapshotsnapshot,Snapshotcrosscheck_snapshot,
13071307
boolread_only,longtcount)
13081308
{
1309-
volatileintres=0;
1309+
volatileintmy_res=0;
13101310
volatileuint32my_processed=0;
13111311
volatileOidmy_lastoid=InvalidOid;
13121312
SPITupleTable*volatilemy_tuptable=NULL;
@@ -1364,6 +1364,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
13641364
Plan*planTree;
13651365
QueryDesc*qdesc;
13661366
DestReceiver*dest;
1367+
intres;
13671368

13681369
planTree=lfirst(plan_list_item);
13691370
plan_list_item=lnext(plan_list_item);
@@ -1380,20 +1381,20 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
13801381

13811382
if (stmt->filename==NULL)
13821383
{
1383-
res=SPI_ERROR_COPY;
1384+
my_res=SPI_ERROR_COPY;
13841385
gotofail;
13851386
}
13861387
}
13871388
elseif (IsA(queryTree->utilityStmt,DeclareCursorStmt)||
13881389
IsA(queryTree->utilityStmt,ClosePortalStmt)||
13891390
IsA(queryTree->utilityStmt,FetchStmt))
13901391
{
1391-
res=SPI_ERROR_CURSOR;
1392+
my_res=SPI_ERROR_CURSOR;
13921393
gotofail;
13931394
}
13941395
elseif (IsA(queryTree->utilityStmt,TransactionStmt))
13951396
{
1396-
res=SPI_ERROR_TRANSACTION;
1397+
my_res=SPI_ERROR_TRANSACTION;
13971398
gotofail;
13981399
}
13991400
}
@@ -1459,7 +1460,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
14591460
ActiveSnapshot=NULL;
14601461

14611462
/*
1462-
* The last canSetTag query sets theauxiliary values returned
1463+
* The last canSetTag query sets thestatus values returned
14631464
* to the caller. Be careful to free any tuptables not
14641465
* returned, to avoid intratransaction memory leak.
14651466
*/
@@ -1469,6 +1470,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
14691470
my_lastoid=_SPI_current->lastoid;
14701471
SPI_freetuptable(my_tuptable);
14711472
my_tuptable=_SPI_current->tuptable;
1473+
my_res=res;
14721474
}
14731475
else
14741476
{
@@ -1477,7 +1479,10 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
14771479
}
14781480
/* we know that the receiver doesn't need a destroy call */
14791481
if (res<0)
1482+
{
1483+
my_res=res;
14801484
gotofail;
1485+
}
14811486
}
14821487
}
14831488

@@ -1503,7 +1508,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
15031508
SPI_lastoid=my_lastoid;
15041509
SPI_tuptable=my_tuptable;
15051510

1506-
returnres;
1511+
returnmy_res;
15071512
}
15081513

15091514
staticint

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp