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

Commitbb0cc20

Browse files
committed
Fix handling of SPI_tuptable.
1 parentbe52414 commitbb0cc20

File tree

1 file changed

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

1 file changed

+12
-19
lines changed

‎src/backend/executor/spi.c

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static int_SPI_begin_call(bool execmem);
6060
staticint_SPI_end_call(boolprocmem);
6161
staticMemoryContext_SPI_execmem(void);
6262
staticMemoryContext_SPI_procmem(void);
63-
staticbool_SPI_checktuples(boolisRetrieveIntoRelation);
63+
staticbool_SPI_checktuples(void);
6464

6565
#ifdefSPI_EXECUTOR_STATS
6666
externintShowExecutorStats;
@@ -774,19 +774,16 @@ _SPI_execute_plan(_SPI_plan * plan, Datum * Values, char *Nulls, int tcount)
774774
staticint
775775
_SPI_pquery(QueryDesc*queryDesc,EState*state,inttcount)
776776
{
777-
Query*parseTree;
778-
Plan*plan;
779-
intoperation;
777+
Query*parseTree=queryDesc->parsetree;
778+
Plan*plan=queryDesc->plantree;
779+
intoperation=queryDesc->operation;
780+
CommandDestdest=queryDesc->dest;
780781
TupleDesctupdesc;
781782
boolisRetrieveIntoPortal= false;
782783
boolisRetrieveIntoRelation= false;
783784
char*intoName=NULL;
784785
intres;
785786

786-
parseTree=queryDesc->parsetree;
787-
plan=queryDesc->plantree;
788-
operation=queryDesc->operation;
789-
790787
switch (operation)
791788
{
792789
caseCMD_SELECT:
@@ -804,6 +801,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
804801
{
805802
res=SPI_OK_SELINTO;
806803
isRetrieveIntoRelation= true;
804+
queryDesc->dest=None;/* */
807805
}
808806
break;
809807
caseCMD_INSERT:
@@ -844,7 +842,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
844842
_SPI_current->processed=state->es_processed;
845843
if (operation==CMD_SELECT&&queryDesc->dest==SPI)
846844
{
847-
if (_SPI_checktuples(isRetrieveIntoRelation))
845+
if (_SPI_checktuples())
848846
elog(FATAL,"SPI_select: # of processed tuples check failed");
849847
}
850848

@@ -858,11 +856,12 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
858856
}
859857
#endif
860858

861-
if (queryDesc->dest==SPI)
859+
if (dest==SPI)
862860
{
863861
SPI_processed=_SPI_current->processed;
864862
SPI_tuptable=_SPI_current->tuptable;
865863
}
864+
queryDesc->dest=dest;
866865

867866
return (res);
868867

@@ -898,7 +897,7 @@ _SPI_fetch(FetchStmt * stmt)
898897
* context */
899898

900899
_SPI_current->processed=state->es_processed;
901-
if (_SPI_checktuples(false))
900+
if (_SPI_checktuples())
902901
elog(FATAL,"SPI_fetch: # of processed tuples check failed");
903902

904903
SPI_processed=_SPI_current->processed;
@@ -982,7 +981,7 @@ _SPI_end_call(bool procmem)
982981
}
983982

984983
staticbool
985-
_SPI_checktuples(boolisRetrieveIntoRelation)
984+
_SPI_checktuples()
986985
{
987986
uint32processed=_SPI_current->processed;
988987
SPITupleTable*tuptable=_SPI_current->tuptable;
@@ -993,15 +992,9 @@ _SPI_checktuples(bool isRetrieveIntoRelation)
993992
if (tuptable!=NULL)
994993
failed= true;
995994
}
996-
else
997-
/* some tuples were processed */
995+
else/* some tuples were processed */
998996
{
999997
if (tuptable==NULL)/* spi_printtup was not called */
1000-
{
1001-
if (!isRetrieveIntoRelation)
1002-
failed= true;
1003-
}
1004-
elseif (isRetrieveIntoRelation)
1005998
failed= true;
1006999
elseif (processed!= (tuptable->alloced-tuptable->free))
10071000
failed= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp