Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error
Дата
Msg-id 24978.1574965593@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causesan error  (Bryan DiCarlo <bryan.dicarlo@gmail.com>)
Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causesan error  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> When creating an updatable "complex" view, if an ON CONFLICT clause is
> provided, an INSERT SELECT to that view will cause "ERROR: variable not
> found in subplan target lists".  Removing the ON CONFLICT clause eliminates
> the error message.

I believe the problem is that you wrote the ON CONFLICT clause
incorrectly:

>   ON CONFLICT (slo_id, time_window, tags) DO UPDATE SET value = NEW.value

You should have written "EXCLUDED.value" not "NEW.value".  There is
a bug here, but it's that the parser accepted this rule.   I'm guessing
that the parsing logic for ON CONFLICT didn't consider the possibility
that NEW and OLD for a rule would already be in the range table.

            regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Numeric is not leakproof
Следующее
От: Bryan DiCarlo
Дата:
Сообщение: Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causesan error