Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
bb0cc20e
Commit
bb0cc20e
authored
Sep 25, 1997
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of SPI_tuptable.
parent
be524142
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
19 deletions
+12
-19
src/backend/executor/spi.c
src/backend/executor/spi.c
+12
-19
No files found.
src/backend/executor/spi.c
View file @
bb0cc20e
...
...
@@ -60,7 +60,7 @@ static int _SPI_begin_call(bool execmem);
static
int
_SPI_end_call
(
bool
procmem
);
static
MemoryContext
_SPI_execmem
(
void
);
static
MemoryContext
_SPI_procmem
(
void
);
static
bool
_SPI_checktuples
(
bool
isRetrieveIntoRelation
);
static
bool
_SPI_checktuples
(
void
);
#ifdef SPI_EXECUTOR_STATS
extern
int
ShowExecutorStats
;
...
...
@@ -774,19 +774,16 @@ _SPI_execute_plan(_SPI_plan * plan, Datum * Values, char *Nulls, int tcount)
static
int
_SPI_pquery
(
QueryDesc
*
queryDesc
,
EState
*
state
,
int
tcount
)
{
Query
*
parseTree
;
Plan
*
plan
;
int
operation
;
Query
*
parseTree
=
queryDesc
->
parsetree
;
Plan
*
plan
=
queryDesc
->
plantree
;
int
operation
=
queryDesc
->
operation
;
CommandDest
dest
=
queryDesc
->
dest
;
TupleDesc
tupdesc
;
bool
isRetrieveIntoPortal
=
false
;
bool
isRetrieveIntoRelation
=
false
;
char
*
intoName
=
NULL
;
int
res
;
parseTree
=
queryDesc
->
parsetree
;
plan
=
queryDesc
->
plantree
;
operation
=
queryDesc
->
operation
;
switch
(
operation
)
{
case
CMD_SELECT
:
...
...
@@ -804,6 +801,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
{
res
=
SPI_OK_SELINTO
;
isRetrieveIntoRelation
=
true
;
queryDesc
->
dest
=
None
;
/* */
}
break
;
case
CMD_INSERT
:
...
...
@@ -844,7 +842,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
_SPI_current
->
processed
=
state
->
es_processed
;
if
(
operation
==
CMD_SELECT
&&
queryDesc
->
dest
==
SPI
)
{
if
(
_SPI_checktuples
(
isRetrieveIntoRelation
))
if
(
_SPI_checktuples
())
elog
(
FATAL
,
"SPI_select: # of processed tuples check failed"
);
}
...
...
@@ -858,11 +856,12 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
}
#endif
if
(
queryDesc
->
dest
==
SPI
)
if
(
dest
==
SPI
)
{
SPI_processed
=
_SPI_current
->
processed
;
SPI_tuptable
=
_SPI_current
->
tuptable
;
}
queryDesc
->
dest
=
dest
;
return
(
res
);
...
...
@@ -898,7 +897,7 @@ _SPI_fetch(FetchStmt * stmt)
* context */
_SPI_current->processed = state->es_processed;
if (_SPI_checktuples(
false
))
if (_SPI_checktuples())
elog(FATAL, "SPI_fetch: # of processed tuples check failed");
SPI_processed = _SPI_current->processed;
...
...
@@ -982,7 +981,7 @@ _SPI_end_call(bool procmem)
}
static
bool
_SPI_checktuples
(
bool
isRetrieveIntoRelation
)
_SPI_checktuples
()
{
uint32
processed
=
_SPI_current
->
processed
;
SPITupleTable
*
tuptable
=
_SPI_current
->
tuptable
;
...
...
@@ -993,15 +992,9 @@ _SPI_checktuples(bool isRetrieveIntoRelation)
if
(
tuptable
!=
NULL
)
failed
=
true
;
}
else
/* some tuples were processed */
else
/* some tuples were processed */
{
if
(
tuptable
==
NULL
)
/* spi_printtup was not called */
{
if
(
!
isRetrieveIntoRelation
)
failed
=
true
;
}
else
if
(
isRetrieveIntoRelation
)
failed
=
true
;
else
if
(
processed
!=
(
tuptable
->
alloced
-
tuptable
->
free
))
failed
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment