diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-03-02 18:56:15 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-03-02 18:56:15 +0000 |
commit | 7bbd9d93cc32044c967c1dbb9b9cfa1bbc7d34d4 (patch) | |
tree | 4e91eabc3f5b201f7ead1f3ac342255de5a7a10c /src/backend/executor/execMain.c | |
parent | b95c05c9c15c9aefb52c66ac84560f078f1a0977 (diff) | |
download | postgresql-7bbd9d93cc32044c967c1dbb9b9cfa1bbc7d34d4.tar.gz postgresql-7bbd9d93cc32044c967c1dbb9b9cfa1bbc7d34d4.zip |
Junkfilter logic to force a projection step during SELECT INTO was too
simplistic; it recognized SELECT * FROM but not SELECT * FROM LIMIT.
Per bug report from Jeff Bohmer.
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 4f36602aa04..caae6e880e5 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -26,7 +26,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.228 2004/01/22 02:23:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.229 2004/03/02 18:56:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -659,10 +659,10 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly) /* * Initialize the junk filter if needed. SELECT and INSERT queries * need a filter if there are any junk attrs in the tlist. INSERT and - * SELECT INTO also need a filter if the top plan node is a scan node - * that's not doing projection (else we'll be scribbling on the scan - * tuple!) UPDATE and DELETE always need a filter, since there's - * always a junk 'ctid' attribute present --- no need to look first. + * SELECT INTO also need a filter if the plan may return raw disk tuples + * (else heap_insert will be scribbling on the source relation!). + * UPDATE and DELETE always need a filter, since there's always a junk + * 'ctid' attribute present --- no need to look first. */ { bool junk_filter_needed = false; @@ -683,18 +683,9 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly) } } if (!junk_filter_needed && - (operation == CMD_INSERT || do_select_into)) - { - if (IsA(planstate, SeqScanState) || - IsA(planstate, IndexScanState) || - IsA(planstate, TidScanState) || - IsA(planstate, SubqueryScanState) || - IsA(planstate, FunctionScanState)) - { - if (planstate->ps_ProjInfo == NULL) - junk_filter_needed = true; - } - } + (operation == CMD_INSERT || do_select_into) && + ExecMayReturnRawTuples(planstate)) + junk_filter_needed = true; break; case CMD_UPDATE: case CMD_DELETE: |