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-hackers(at)postgreSQL(dot)org, pgsql-bugs(at)postgreSQL(dot)org, matthew(dot)copeland(at)honeywell(dot)com
Subject: Re: Conditional NOTIFY is not implemented
Date: 2001-09-06 19:16:26
Message-ID: 3591.999803786@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

tomas(at)fabula(dot)de writes:
> versuch=# CREATE RULE ru_u_chkntfy AS ON UPDATE TO chkntfy DO NOTIFY CHKNTFY;
> CREATE
> versuch=# update chkntfy set nummer=10 where nummer = 1;
> ERROR: Conditional NOTIFY is not implemented

> Somehow the notify seems to take up the `where' qualifier of the query
> triggering the rule (you don't get the error message if you use an
> unqualified query).

> Is this considered a bug? Is a fix in sight?

Before 7.1, the system simply failed to account for the condition that
should be applied to the notify --- the notify ended up being fired all
the time, even if it shouldn't have been. In this case, the notify
should only occur if there are rows in chkntfy with nummer = 1 --- but
pre-7.1, it'd occur regardless. (We were rather fortunate to avoid a
crash, actually, since the code would attach a condition to a NOTIFY
querytree that should never have had one ... but then ignore it.)

Present behavior is to error out if the rewriter tries to attach a
nonempty condition to a NOTIFY query.

It'd be a simple code change to revert to the pre-7.1 behavior (notify
fires unconditionally), but actually making it work *correctly* is a
lot harder. NOTIFYs don't normally have any plan associated with them
at all, so there's no way to test a query condition.

Since we've seen several complaints about the new behavior, whereas
no one ever complained about excess NOTIFYs pre-7.1, perhaps the best
solution in the short run is to revert to the old behavior. We could
just document that NOTIFYs in rules are fired unconditionally.

Comments?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-09-06 19:24:54 Re: parse error: LIMIT combined with UNION
Previous Message Tom Lane 2001-09-06 19:06:12 Re: I have a serious problem with hanging backends.

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Mascari 2001-09-06 20:01:16 Re: TRUNCATE question
Previous Message Bruce Momjian 2001-09-06 18:50:22 Re: cvs tip: gmake breakage.