Re: NEW.* and OLD.* inside trigger function don't seem to contain recently added columns
| От | Tom Lane |
|---|---|
| Тема | Re: NEW.* and OLD.* inside trigger function don't seem to contain recently added columns |
| Дата | |
| Msg-id | 1218764.1711154512@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | NEW.* and OLD.* inside trigger function don't seem to contain recently added columns (Janne Annala <janne.annala@forenom.com>) |
| Ответы |
Re: NEW.* and OLD.* inside trigger function don't seem to contain recently added columns
|
| Список | pgsql-bugs |
Janne Annala <janne.annala@forenom.com> writes:
> Here's the minimum case to reproduce the issue:
> CREATE FUNCTION x()
> RETURNS trigger
> LANGUAGE plpgsql
> AS $function$
> BEGIN
> IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) THEN
Try dropping the ROW() bit, that is just
IF NEW.* IS DISTINCT FROM OLD.* THEN
or even
IF NEW IS DISTINCT FROM OLD THEN
I think what is happening is that the ROW() notation is getting
expanded at parse time to
ROW(NEW.id, NEW.old_column, NEW.updated)
and then there's no dependency on the original rowtype that would
lead to that expansion getting reconsidered. Arguably that's a
bug, but it's not clear to me what the consequences of changing
that behavior would be.
regards, tom lane
В списке pgsql-bugs по дате отправления: