Re: Unexpected behavior when combining `generated always` columns and update rules

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Unexpected behavior when combining `generated always` columns and update rules
Дата
Msg-id CAKFQuwakXc0RRNU49n1FYmXXDBukvTeDRbXZZ+Fuyy2y-Z5N=g@mail.gmail.com
обсуждение исходный текст
Ответ на Unexpected behavior when combining `generated always` columns and update rules  (Ciprian Craciun <ciprian.craciun@gmail.com>)
Ответы Re: Unexpected behavior when combining `generated always` columns and update rules  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Unexpected behavior when combining `generated always` columns and update rules  (Ciprian Craciun <ciprian.craciun@gmail.com>)
Список pgsql-general
On Thursday, April 13, 2023, Ciprian Craciun <ciprian.craciun@gmail.com> wrote:

create or replace rule propagate_x_and_d as on update to x do also
    update y set x = new.x, d = new.d where y.x = old.x;

As seen above, although the rule correctly propagates the change to
the `x` column, it fails to use the new value for the `d` column, but
instead uses the previous one.

ALSO rules behave like before triggers, not after triggers. The original command is appended to the end of the list of commands, not the start.

David J.

В списке pgsql-general по дате отправления:

Предыдущее
От: Ciprian Craciun
Дата:
Сообщение: Unexpected behavior when combining `generated always` columns and update rules
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unexpected behavior when combining `generated always` columns and update rules