Search Postgresql Archives

Re: Rule appears not to fire on insert w/ "except"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Kratz <chris.kratz@xxxxxxxxxxxxxx> writes:
> CREATE OR REPLACE RULE debug_rule AS
>     ON INSERT TO test1
>    do INSERT INTO test_que (row_id)
>   VALUES (new.id);

You would be a whole lot better off doing this with a trigger.

> insert into test1
>   select id,data from test2
>   except select id,data from test1;

I believe the problem with this is that the rule re-evaluates the
command to generate the "new" results, and by that point the rows
have already been inserted into test1, thus disappear from the
result of the "except" ...

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux