Re: ON CONFLICT DO NOTHING RETURNING

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Peter Devoy <peter(at)3xe(dot)co(dot)uk>, "Psql_General (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ON CONFLICT DO NOTHING RETURNING
Date: 2016-03-18 21:29:51
Message-ID: CAH2-WzmuYnC_6Mdro7X_2ipwt3TCgA0FrS52-99xQ6jSiRf2tA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 18, 2016 at 9:14 AM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> He wants to retrieve a value from the conflicting row. Now getting
> the value that caused the conflict should be easy, because you
> provided it in the first place. But he wants a value from a
> different column of the conflicting row than the column(s) on which
> there is conflict. DO NOTHING RETURNING returns no rows. Which is
> reasonable, because nothing was inserted. But it isn't what he wants.

I see.

> I think the dummy update is his best bet, but it does seem like there
> should be a better way. Maybe ON CONFLICT DO SELECT where the select
> operates over the target row.

Seems reasonable.

--
Peter Geoghegan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-03-18 21:46:46 Re: [GENERAL] grant select on pg_stat_activity
Previous Message pbj 2016-03-18 21:22:58 Re: Question about shared_buffer cache behavior