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");
        }

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to