diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-07-16 17:25:48 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-07-16 17:25:48 +0000 |
commit | 93236b58e088cd2151540528d484da9ad82e48c8 (patch) | |
tree | 5d12e2000fc4813421d32b94e042d6a04ce07e29 /src/backend/parser | |
parent | 96be4b28a31e37d2eb2757118164a6c9ae297d46 (diff) | |
download | postgresql-93236b58e088cd2151540528d484da9ad82e48c8.tar.gz postgresql-93236b58e088cd2151540528d484da9ad82e48c8.zip |
Add defenses against trying to attach qual conditions to a setOperation
query node, since that won't work unless the planner is upgraded.
Someday we should try to support at least some cases of this, but for
now just plug the hole in the dike. Per discussion with Dmitry Tkach.
Diffstat (limited to 'src/backend/parser')
-rw-r--r-- | src/backend/parser/analyze.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 90818b153b8..ca7759cfc82 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.278 2003/07/03 19:07:30 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.279 2003/07/16 17:25:48 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1788,6 +1788,15 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt, sub_qry = getInsertSelectQuery(top_subqry, NULL); /* + * If the sub_qry is a setop, we cannot attach any qualifications + * to it, because the planner won't notice them. This could + * perhaps be relaxed someday, but for now, we may as well reject + * such a rule immediately. + */ + if (sub_qry->setOperations != NULL && stmt->whereClause != NULL) + elog(ERROR, "Conditional UNION/INTERSECT/EXCEPT statements are not implemented"); + + /* * Validate action's use of OLD/NEW, qual too */ has_old = @@ -1841,6 +1850,13 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt, */ if (has_old || (has_new && stmt->event == CMD_UPDATE)) { + /* + * If sub_qry is a setop, manipulating its jointree will do + * no good at all, because the jointree is dummy. (This + * should be a can't-happen case because of prior tests.) + */ + if (sub_qry->setOperations != NULL) + elog(ERROR, "Conditional UNION/INTERSECT/EXCEPT statements are not implemented"); /* hack so we can use addRTEtoQuery() */ sub_pstate->p_rtable = sub_qry->rtable; sub_pstate->p_joinlist = sub_qry->jointree->fromlist; |