Re: create rule ... as on insert - Mailing list pgsql-general

From Janning Vygen
Subject Re: create rule ... as on insert
Date
Msg-id 200506241742.38480.vygen@gmx.de
Whole thread Raw
In response to create rule ... as on insert  (Omachonu Ogali <missnglnk@informationwave.net>)
List pgsql-general
Am Freitag, 24. Juni 2005 17:05 schrieb Omachonu Ogali:
> I'm using PostgreSQL 7.4.2, and I'm having a little issue with rules.
>
> I created a rule to watch for any inserts to table XYZ, and registered
> a listener. But as I simply do a select on the table, I receive several
> notifications when nothing has been inserted into the table.
[...]
> I'm the only one with full rights to this table, and the only one that
> is currently working on this database. There is another rule that I've
> created (and is currently active), that does inserts into xyz from
> another table, but as you can see below, there are no new inserts.
>
> db=# select * from xyz;
> ( 2 rows)

there is no need that something is really inserted i guess. from the docs:
"Presently, if a rule action contains a NOTIFY command, the NOTIFY command
will be executed unconditionally, that is, the NOTIFY will be issued even if
there are not any rows that the rule should apply to. For example, in

CREATE RULE notify_me AS ON UPDATE TO mytable DO NOTIFY mytable;

UPDATE mytable SET name = 'foo' WHERE id = 42;
" [sql-createrule.html]

So maybe your other rule is trying to insert nothing like the UPDATE command
in the example above.

kind regards,
janning

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: PostgreSQL Certification
Next
From: Tom Lane
Date:
Subject: Re: PostgreSQL Certification