aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-09-07 20:52:31 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-09-07 20:52:31 +0000
commit17c03b30b0f191e62e992dc6af8c995fd2b007a2 (patch)
treeae401bda87878b44bea87c629ac74473c0910378 /src
parent8c55728295421f820920a15750cc2938d360c66c (diff)
downloadpostgresql-17c03b30b0f191e62e992dc6af8c995fd2b007a2.tar.gz
postgresql-17c03b30b0f191e62e992dc6af8c995fd2b007a2.zip
Revert treatment of NOTIFY in rules to its pre-7.1 behavior: notify will
occur unconditionally, even if the rule should otherwise execute conditionally. This is more useful than giving an error, even though it's not truly the correct behavior. Per today's pghackers discussion.
Diffstat (limited to 'src')
-rw-r--r--src/backend/rewrite/rewriteManip.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c
index 45115b8d045..238897d58eb 100644
--- a/src/backend/rewrite/rewriteManip.c
+++ b/src/backend/rewrite/rewriteManip.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.57 2001/04/18 20:42:55 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.58 2001/09/07 20:52:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -592,15 +592,21 @@ AddQual(Query *parsetree, Node *qual)
if (parsetree->commandType == CMD_UTILITY)
{
-
/*
- * Noplace to put the qual on a utility statement.
+ * There's noplace to put the qual on a utility statement.
+ *
+ * If it's a NOTIFY, silently ignore the qual; this means that the
+ * NOTIFY will execute, whether or not there are any qualifying rows.
+ * While clearly wrong, this is much more useful than refusing to
+ * execute the rule at all, and extra NOTIFY events are harmless for
+ * typical uses of NOTIFY.
*
- * For now, we expect utility stmt to be a NOTIFY, so give a specific
- * error message for that case.
+ * If it isn't a NOTIFY, error out, since unconditional execution
+ * of other utility stmts is unlikely to be wanted. (This case is
+ * not currently allowed anyway, but keep the test for safety.)
*/
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
- elog(ERROR, "Conditional NOTIFY is not implemented");
+ return;
else
elog(ERROR, "Conditional utility statements are not implemented");
}
@@ -634,15 +640,13 @@ AddHavingQual(Query *parsetree, Node *havingQual)
if (parsetree->commandType == CMD_UTILITY)
{
-
/*
- * Noplace to put the qual on a utility statement.
+ * There's noplace to put the qual on a utility statement.
*
- * For now, we expect utility stmt to be a NOTIFY, so give a specific
- * error message for that case.
+ * See comments in AddQual for motivation.
*/
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
- elog(ERROR, "Conditional NOTIFY is not implemented");
+ return;
else
elog(ERROR, "Conditional utility statements are not implemented");
}