Re: insert on conflict postgres returning distinction

Поиск
Список
Период
Сортировка
От pinker
Тема Re: insert on conflict postgres returning distinction
Дата
Msg-id 1597258357335-0.post@n3.nabble.com
обсуждение исходный текст
Ответ на Re: insert on conflict postgres returning distinction  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: insert on conflict postgres returning distinction  (pinker <pinker@onet.eu>)
Список pgsql-general
how about this solution?
Does it have any caveats?

WITH upsert AS (INSERT INTO GUCIO (ID, NAZWA)
    SELECT A.ID, A.NAZWA
    FROM ALA A
    ON CONFLICT (ID) DO UPDATE SET
        nazwa = excluded.nazwa
    RETURNING xmax,xmin, *)
select xmax as xmax_value
into txmaxu
from upsert;

delete
from gucio
where xmax = (select xmax_value from txmaxu where xmax_value <> 0 limit 1);



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html



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

Предыдущее
От: Michael Lewis
Дата:
Сообщение: Re: Sizing PostgreSQL VM server sizing
Следующее
От: pinker
Дата:
Сообщение: Re: insert on conflict postgres returning distinction