Re: Conditional NOTIFY is not implemented

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: tomas(at)fabula(dot)de
Cc: pgsql-bugs(at)postgreSQL(dot)org, matthew(dot)copeland(at)honeywell(dot)com
Subject: Re: Conditional NOTIFY is not implemented
Date: 2001-09-07 20:58:16
Message-ID: 4583.999896296@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I said:
> Changing the rewriter to error out when it couldn't really Do The Right
> Thing seemed like a good idea at the time, but now it seems clear that
> this didn't do anything to enhance the usefulness of the system. Unless
> someone objects, I'll change it back for 7.2.

Not having seen any objections, I've committed the change. If you need
a fix in place before 7.2, it's really a trivial change: just replace
the elog calls (there are two) by "return". See attached patch against
current sources.

regards, tom lane

*** /home/postgres/pgsql/src/backend/rewrite/rewriteManip.c.orig Wed Apr 18 16:42:55 2001
--- /home/postgres/pgsql/src/backend/rewrite/rewriteManip.c Fri Sep 7 16:52:31 2001
***************
*** 592,606 ****

if (parsetree->commandType == CMD_UTILITY)
{
-
/*
! * 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.
*/
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
! elog(ERROR, "Conditional NOTIFY is not implemented");
else
elog(ERROR, "Conditional utility statements are not implemented");
}
--- 592,612 ----

if (parsetree->commandType == CMD_UTILITY)
{
/*
! * 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.
*
! * 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))
! return;
else
elog(ERROR, "Conditional utility statements are not implemented");
}
***************
*** 634,648 ****

if (parsetree->commandType == CMD_UTILITY)
{
-
/*
! * 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.
*/
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
! elog(ERROR, "Conditional NOTIFY is not implemented");
else
elog(ERROR, "Conditional utility statements are not implemented");
}
--- 640,652 ----

if (parsetree->commandType == CMD_UTILITY)
{
/*
! * There's noplace to put the qual on a utility statement.
*
! * See comments in AddQual for motivation.
*/
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
! return;
else
elog(ERROR, "Conditional utility statements are not implemented");
}

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-09-07 21:16:47 Re: Logging problems in PostgreSQL 7.2devel
Previous Message grant 2001-09-07 19:24:45 Re: Bug #441: Index using INT8 data type is ignored

Browse pgsql-hackers by date

  From Date Subject
Next Message Giles Lean 2001-09-07 21:21:19 Re: Log rotation?
Previous Message Bruce Momjian 2001-09-07 20:39:20 Re: ODBC TODO list is way out of date