Re: Upsert error "column reference is ambiguous"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Upsert error "column reference is ambiguous"
Дата
Msg-id 1026716.1745938318@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Upsert error "column reference is ambiguous"  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-general
David Rowley <dgrowleyml@gmail.com> writes:
> Another thought is that you can have an UPDATE with a RETURNING
> clause. An unqualified column defaults to NEW even though you could
> argue it's ambiguous due to OLD (as of 80feb727c). Likely we were
> forced into making it work that way through not wanting to force
> everyone to rewrite their RETURNING statements when upgrading to v18.
> The moral of that story is, UPDATE isn't exactly consistent already
> about when it requires column qualifications. Maybe it's weird to
> insist that users qualify columns with their ON CONFLICT UPDATE SET
> when RETURNING is happy to assume you must have meant NEW.

That's an analogy I hadn't thought of, and it does seem on-point.
You might be right that we would not have done it like that if
we'd invented RETURNING's ability to support "OLD" at the get-go.
Nonetheless, it's there now and is a pretty similar precedent.

            regards, tom lane



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