BUG #15960: ON CONFLICT Trying accessing to variables

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #15960: ON CONFLICT Trying accessing to variables
Дата
Msg-id 15960-ea463c93a1f572db@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #15960: ON CONFLICT Trying accessing to variables  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15960
Logged by:          Anton Dutov
Email address:      anton.dutov@gmail.com
PostgreSQL version: 11.3
Operating system:   Linux
Description:

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



Reproduce

CREATE TABLE IF NOT EXISTS test_table (id INT PRIMARY KEY, note TEXT);

CREATE OR REPLACE FUNCTION test_table_add (
  in_id   INT
 ,in_note TEXT
 ,OUT id INT
) RETURNS INT LANGUAGE plpgsql VOLATILE SECURITY DEFINER AS $$
BEGIN
    INSERT INTO test_table (id, note) VALUES (in_id, in_note)
      ON CONFLICT (id) DO UPDATE SET note = in_note;
END;
$$;

SELECT test_table_add (1, 'ONE');


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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15959: 'DROP EXTENSION pglogical' while an unused logical replication slot exists causes slot corruption
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: BUG #15960: ON CONFLICT Trying accessing to variables