Hi!

I compiled the 7.1 version of the snapshot dated on the December 18 (on i386 
Linux Red Hat 6.1). 
Using the notify in the rule actions I get some errors and I suppose they are 
bugs.

The first one when the rule is triggered: 

[postgres@ postgres]$ createdb test
CREATE DATABASE

test=# create table test_notify(one int);
CREATE

test=# create rule i_test_notify as on insert to test_notify do notify ONE;
CREATE

test=# insert into test_notify values (1);
pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!#            


The second one (exactly, this is not a bug) when I try to see the rule 
definition.

test=# select * from pg_rules;
ERROR:  get_ruledef of i_test_notify: query command type 5 not implemented yet


Finally, when a dump of the database is performed:

[postgres@ postgres]$ pg_dump test > test.pgdump
dumpRules(): SELECT failed for rules associated with table "test_notify".
        Explanation from backend: 'ERROR:  get_ruledef of i_test_notify: query 
command type 5 not implemented yet
'.

This error is produced in the same way as in the previous case but in this 
case, there is an additional problem since the dump aborts.

Within the patch I attach, you can find the solution for these problems:

To solve the first error the function gatherRewriteMeta in RewriteHandler.c was 
modified

To solve the second and third errors the function get_utility_query_def in 
ruleutils.c was added. The function get_query_def in ruleutils.c was modified 
as well.


Would someone like to review it?

Thnaks.

Sergio.
Fri, 29 Dec 2000 16:58:02 -0300
sergiop@sinectis.com.ar
Notify with Rules bugs?
sergiop@sinectis.com.ar writes:
> I compiled the 7.1 version of the snapshot dated on the December 18
> (on i386 Linux Red Hat 6.1).  Using the notify in the rule actions I
> get some errors and I suppose they are bugs.

Thanks for the report and patch!

I don't like the unchecked assumption that get_utility_query_def() will
never see anything except a NotifyStmt, but I'll fix that and apply it.

			regards, tom lane

Fri, 29 Dec 2000 17:09:22 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Notify with Rules bugs? 