diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-08-19 18:11:02 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-08-19 18:11:02 +0000 |
commit | a1bde80db45fe9f123abb2a493b9dfcb755d427d (patch) | |
tree | 3442c58fde21b851202c1d421a6984d1c803197c | |
parent | f958310a85ba6e9c50c52ccf98ebd5425136931c (diff) | |
download | postgresql-a1bde80db45fe9f123abb2a493b9dfcb755d427d.tar.gz postgresql-a1bde80db45fe9f123abb2a493b9dfcb755d427d.zip |
Keep exec_simple_check_plan() from thinking "SELECT foo INTO bar" is simple.
It's not clear if this situation can occur in plpgsql other than via the
EXECUTE USING case Heikki illustrated, which I will shortly close off.
However, ignoring the intoClause if it's there is surely wrong, so let's
patch it for safety.
Backpatch to 8.3, which is as far back as this code has a PlannedStmt
to deal with. There might be another way to make an equivalent test
before that, but since this is just preventing hypothetical bugs,
I'm not going to obsess about it.
-rw-r--r-- | src/pl/plpgsql/src/pl_exec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 04067c176ea..8d0c62559b6 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.244.2.9 2010/08/19 17:31:56 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.244.2.10 2010/08/19 18:11:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -5148,6 +5148,8 @@ exec_simple_check_plan(PLpgSQL_expr *expr) */ if (!IsA(stmt, PlannedStmt)) return; + if (stmt->commandType != CMD_SELECT || stmt->intoClause) + return; plan = stmt->planTree; if (!IsA(plan, Result)) return; |