mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Make SPI set SPI_processed for CREATE TABLE AS / SELECT INTO commands;
this in turn causes CREATE TABLE AS in plpgsql to set ROW_COUNT. This is how it behaved before 7.4; I had unintentionally changed the behavior in a bit of sloppy micro-optimization.
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.140 2005/05/06 17:24:54 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.141 2005/06/09 21:25:22 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1497,6 +1497,7 @@ static int
|
|||||||
_SPI_pquery(QueryDesc *queryDesc, long tcount)
|
_SPI_pquery(QueryDesc *queryDesc, long tcount)
|
||||||
{
|
{
|
||||||
int operation = queryDesc->operation;
|
int operation = queryDesc->operation;
|
||||||
|
CommandDest origDest = queryDesc->dest->mydest;
|
||||||
int res;
|
int res;
|
||||||
Oid save_lastoid;
|
Oid save_lastoid;
|
||||||
|
|
||||||
@ -1504,7 +1505,7 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount)
|
|||||||
{
|
{
|
||||||
case CMD_SELECT:
|
case CMD_SELECT:
|
||||||
res = SPI_OK_SELECT;
|
res = SPI_OK_SELECT;
|
||||||
if (queryDesc->parsetree->into != NULL) /* select into table */
|
if (queryDesc->parsetree->into) /* select into table? */
|
||||||
{
|
{
|
||||||
res = SPI_OK_SELINTO;
|
res = SPI_OK_SELINTO;
|
||||||
queryDesc->dest = None_Receiver; /* don't output results */
|
queryDesc->dest = None_Receiver; /* don't output results */
|
||||||
@ -1548,7 +1549,8 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount)
|
|||||||
|
|
||||||
ExecutorEnd(queryDesc);
|
ExecutorEnd(queryDesc);
|
||||||
|
|
||||||
if (queryDesc->dest->mydest == SPI)
|
/* Test origDest here so that SPI_processed gets set in SELINTO case */
|
||||||
|
if (origDest == SPI)
|
||||||
{
|
{
|
||||||
SPI_processed = _SPI_current->processed;
|
SPI_processed = _SPI_current->processed;
|
||||||
SPI_lastoid = save_lastoid;
|
SPI_lastoid = save_lastoid;
|
||||||
|
Reference in New Issue
Block a user