Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
bb0cc20e
Commit
bb0cc20e
authored
27 years ago
by
Vadim B. Mikheev
Browse files
Options
Downloads
Patches
Plain Diff
Fix handling of SPI_tuptable.
parent
be524142
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/executor/spi.c
+12
-19
12 additions, 19 deletions
src/backend/executor/spi.c
with
12 additions
and
19 deletions
src/backend/executor/spi.c
+
12
−
19
View file @
bb0cc20e
...
@@ -60,7 +60,7 @@ static int _SPI_begin_call(bool execmem);
...
@@ -60,7 +60,7 @@ static int _SPI_begin_call(bool execmem);
static
int
_SPI_end_call
(
bool
procmem
);
static
int
_SPI_end_call
(
bool
procmem
);
static
MemoryContext
_SPI_execmem
(
void
);
static
MemoryContext
_SPI_execmem
(
void
);
static
MemoryContext
_SPI_procmem
(
void
);
static
MemoryContext
_SPI_procmem
(
void
);
static
bool
_SPI_checktuples
(
bool
isRetrieveIntoRelation
);
static
bool
_SPI_checktuples
(
void
);
#ifdef SPI_EXECUTOR_STATS
#ifdef SPI_EXECUTOR_STATS
extern
int
ShowExecutorStats
;
extern
int
ShowExecutorStats
;
...
@@ -774,19 +774,16 @@ _SPI_execute_plan(_SPI_plan * plan, Datum * Values, char *Nulls, int tcount)
...
@@ -774,19 +774,16 @@ _SPI_execute_plan(_SPI_plan * plan, Datum * Values, char *Nulls, int tcount)
static
int
static
int
_SPI_pquery
(
QueryDesc
*
queryDesc
,
EState
*
state
,
int
tcount
)
_SPI_pquery
(
QueryDesc
*
queryDesc
,
EState
*
state
,
int
tcount
)
{
{
Query
*
parseTree
;
Query
*
parseTree
=
queryDesc
->
parsetree
;
Plan
*
plan
;
Plan
*
plan
=
queryDesc
->
plantree
;
int
operation
;
int
operation
=
queryDesc
->
operation
;
CommandDest
dest
=
queryDesc
->
dest
;
TupleDesc
tupdesc
;
TupleDesc
tupdesc
;
bool
isRetrieveIntoPortal
=
false
;
bool
isRetrieveIntoPortal
=
false
;
bool
isRetrieveIntoRelation
=
false
;
bool
isRetrieveIntoRelation
=
false
;
char
*
intoName
=
NULL
;
char
*
intoName
=
NULL
;
int
res
;
int
res
;
parseTree
=
queryDesc
->
parsetree
;
plan
=
queryDesc
->
plantree
;
operation
=
queryDesc
->
operation
;
switch
(
operation
)
switch
(
operation
)
{
{
case
CMD_SELECT
:
case
CMD_SELECT
:
...
@@ -804,6 +801,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
...
@@ -804,6 +801,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
{
{
res
=
SPI_OK_SELINTO
;
res
=
SPI_OK_SELINTO
;
isRetrieveIntoRelation
=
true
;
isRetrieveIntoRelation
=
true
;
queryDesc
->
dest
=
None
;
/* */
}
}
break
;
break
;
case
CMD_INSERT
:
case
CMD_INSERT
:
...
@@ -844,7 +842,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
...
@@ -844,7 +842,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
_SPI_current
->
processed
=
state
->
es_processed
;
_SPI_current
->
processed
=
state
->
es_processed
;
if
(
operation
==
CMD_SELECT
&&
queryDesc
->
dest
==
SPI
)
if
(
operation
==
CMD_SELECT
&&
queryDesc
->
dest
==
SPI
)
{
{
if
(
_SPI_checktuples
(
isRetrieveIntoRelation
))
if
(
_SPI_checktuples
())
elog
(
FATAL
,
"SPI_select: # of processed tuples check failed"
);
elog
(
FATAL
,
"SPI_select: # of processed tuples check failed"
);
}
}
...
@@ -858,11 +856,12 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
...
@@ -858,11 +856,12 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
}
}
#endif
#endif
if
(
queryDesc
->
dest
==
SPI
)
if
(
dest
==
SPI
)
{
{
SPI_processed
=
_SPI_current
->
processed
;
SPI_processed
=
_SPI_current
->
processed
;
SPI_tuptable
=
_SPI_current
->
tuptable
;
SPI_tuptable
=
_SPI_current
->
tuptable
;
}
}
queryDesc
->
dest
=
dest
;
return
(
res
);
return
(
res
);
...
@@ -898,7 +897,7 @@ _SPI_fetch(FetchStmt * stmt)
...
@@ -898,7 +897,7 @@ _SPI_fetch(FetchStmt * stmt)
* context */
* context */
_SPI_current->processed = state->es_processed;
_SPI_current->processed = state->es_processed;
if (_SPI_checktuples(
false
))
if (_SPI_checktuples())
elog(FATAL, "SPI_fetch: # of processed tuples check failed");
elog(FATAL, "SPI_fetch: # of processed tuples check failed");
SPI_processed = _SPI_current->processed;
SPI_processed = _SPI_current->processed;
...
@@ -982,7 +981,7 @@ _SPI_end_call(bool procmem)
...
@@ -982,7 +981,7 @@ _SPI_end_call(bool procmem)
}
}
static
bool
static
bool
_SPI_checktuples
(
bool
isRetrieveIntoRelation
)
_SPI_checktuples
()
{
{
uint32
processed
=
_SPI_current
->
processed
;
uint32
processed
=
_SPI_current
->
processed
;
SPITupleTable
*
tuptable
=
_SPI_current
->
tuptable
;
SPITupleTable
*
tuptable
=
_SPI_current
->
tuptable
;
...
@@ -993,15 +992,9 @@ _SPI_checktuples(bool isRetrieveIntoRelation)
...
@@ -993,15 +992,9 @@ _SPI_checktuples(bool isRetrieveIntoRelation)
if
(
tuptable
!=
NULL
)
if
(
tuptable
!=
NULL
)
failed
=
true
;
failed
=
true
;
}
}
else
else
/* some tuples were processed */
/* some tuples were processed */
{
{
if
(
tuptable
==
NULL
)
/* spi_printtup was not called */
if
(
tuptable
==
NULL
)
/* spi_printtup was not called */
{
if
(
!
isRetrieveIntoRelation
)
failed
=
true
;
}
else
if
(
isRetrieveIntoRelation
)
failed
=
true
;
failed
=
true
;
else
if
(
processed
!=
(
tuptable
->
alloced
-
tuptable
->
free
))
else
if
(
processed
!=
(
tuptable
->
alloced
-
tuptable
->
free
))
failed
=
true
;
failed
=
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment