From: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
---|---|
To: | "PostgreSQL General" <pgsql-general(at)postgresql(dot)org> |
Subject: | multiple statement 'instead of' rule |
Date: | 2006-06-21 03:05:53 |
Message-ID: | b42b73150606202005o2b7bba05l2172807036b7e88d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have a repeatable issue where on an update rule (attached to a view)
not all of the statements are firing under certain conditions. There
is no error but the rule does not seem to be completely going through
the statements. I'm not sure if this is correct behavior reading the
documentation but it smells funny. I confirmed the statements are not
updating by
inserting sql log statements in between the queries in the rule.
Also, by converting the rule to a rule + sql function it works 100%
correct every time. this is on postgresql 8.1.4 on windows xp.
create or replace rule insert_fsv as on insert to frequency_service_view
do instead
(
insert into frequency_operation
select new.table_name, new.frequency, old.code where new.set =
true and old.set = false;
delete from frequency_operation
where table_name = old.table_name and frequency_operation.code =
old.code and
frequency_operation.frequency = new.frequency and new.set = false;
update operation
set code = new.code where code = old.code and old.code != new.code;
);
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-06-21 03:58:51 | Re: multiple statement 'instead of' rule |
Previous Message | Tom Lane | 2006-06-21 02:42:59 | Re: Lock contention during inserts |