On Fri, Nov 20, 2009 at 9:58 AM, Marcel Wieland
<marcel.wiel...@fondsnet.de> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5202
> Logged by:          Marcel Wieland
> Email address:      marcel.wiel...@fondsnet.de
> PostgreSQL version: 8.2
> Operating system:   Linux
> Description:        Rule affecting more than one row is only fired once with
> LIMIT 1
> Details:
>
> BEGIN;
>
> -- Create testing Tables
> CREATE TABLE footable (
>    name char
> );
> CREATE TABLE bartable (
>    foo char
> );
>
> -- Insert testing Values
> INSERT INTO footable (name) VALUES('a'), ('b');
>
> -- RULE with LIMIT 1
> CREATE OR REPLACE RULE foorule AS ON UPDATE TO footable DO
>    INSERT INTO bartable (foo) SELECT name FROM footable WHERE name =
> old.name LIMIT 1;
>
> -- Query fires Rule
> UPDATE footable SET name = name;
> -- Result
> SELECT * FROM bartable;
>
> -- Reset
> DELETE FROM bartable;
>
> -- RULE without LIMIT 1
> CREATE OR REPLACE RULE foorule AS ON UPDATE TO footable DO
>    INSERT INTO bartable (foo) SELECT name FROM footable WHERE name =
> old.name;
>
> -- Query fires Rule
> UPDATE footable SET name = name;
> -- Result
> SELECT * FROM bartable;
>
> -- Cleanup
> DROP TABLE footable;
> DROP TABLE bartable;
>
> ROLLBACK;

See my response to your other bug report - same issues apply here.

...Robert

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to