Re: BUG #15960: ON CONFLICT Trying accessing to variables

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: BUG #15960: ON CONFLICT Trying accessing to variables
Дата
Msg-id CAH2-Wzm7KDqfuekQ4NGH_YimW-Jw7wYg82mJyNM_zi=7oXEiSA@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #15960: ON CONFLICT Trying accessing to variables  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #15960: ON CONFLICT Trying accessing to variables  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
On Thu, Aug 15, 2019 at 6:28 AM PG Bug reporting form
<noreply@postgresql.org> wrote:
> Using upsert in stored procedure  ON CONFLICT(id, ...)  trows "ERROR: column
> reference "id" is ambiguous" where id used as column name and as variable,
> but ON CONFLICT can't use variables

This is not a bug. You must resolve the ambiguity by using a plpgsql
variable whose name isn't exactly the same as a column name.

In principle you can have an index on a simple constant, which is
occasionally useful (e.g. using a unique index to enforce that you can
either have zero or one rows in some particular table).

-- 
Peter Geoghegan



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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15960: ON CONFLICT Trying accessing to variables
Следующее
От: Andres Freund
Дата:
Сообщение: Re: BUG #15960: ON CONFLICT Trying accessing to variables