From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Sergio Pili <sergiop(at)sinectis(dot)com(dot)ar> |
Cc: | pgsql-hackers(at)postgresql(dot)org, Laura Celia Rivero <lrivero(at)exa(dot)unicen(dot)edu(dot)ar>, Jorge Doorn <jdoorn(at)exa(dot)unicen(dot)edu(dot)ar> |
Subject: | Re: Change in rule behavior? |
Date: | 2001-11-25 23:17:07 |
Message-ID: | 5691.1006730227@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Sergio Pili <sergiop(at)sinectis(dot)com(dot)ar> writes:
> psql:sql/rd_ri/bug_upd.sql:11: ERROR: Rules with WHERE conditions may
> only have SELECT, INSERT, UPDATE, or DELETE actions
> Why was changed?
> Is it possible to maintain the previous behavior with my correction?
Because it didn't work. Your patch might prevent a coredump, but it
doesn't make the rule work correctly. See the comment on the error
message:
/*
* We cannot support utility-statement actions (eg NOTIFY)
* with nonempty rule WHERE conditions, because there's no way
* to make the utility action execute conditionally.
*/
if (top_subqry->commandType == CMD_UTILITY &&
stmt->whereClause != NULL)
elog(ERROR, "Rules with WHERE conditions may only have SELECT, INSERT, UPDATE, or DELETE actions");
What actually happened in your patched 7.1 was that the NOTIFY message
was sent regardless of whether the WHERE condition was true or not.
If you want that behavior, it's easy enough to get: put the NOTIFY in a
separate rule that has no WHERE.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Inoue | 2001-11-26 00:25:14 | Re: pg_config.h.win32 |
Previous Message | Tom Lane | 2001-11-25 23:05:37 | Re: Bug in pg_get_ruledef? |