On Sat, Dec 19, 2009 at 7:16 PM, Christophe Pettus <xof@thebuild.com> wrote:
>
>> I understand that it is not possible to read previous rows without
>> creating hack using triggers.
>
> As noted above, that's not correct. You cannot access new values of a
> particular row within a single UPDATE statement, but you do see new values
> done in the same transaction.
>
what´s the problem with something as simple as:
create function keep_a_in_b_test1() returns trigger as $$
begin
new.b = old.a;
return new;
end;
$$ language plpgsql;
create trigger trg_keep_a_in_b_test1 before update
on test1 for each row execute procedure keep_a_in_b_test1();
--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157