Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}

Поиск
Список
Период
Сортировка
От Andreas Karlsson
Тема Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Дата
Msg-id 53FF7F3D.4040407@proxel.se
обсуждение исходный текст
Ответ на Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}  (Peter Geoghegan <pg@heroku.com>)
Список pgsql-hackers
On 08/28/2014 09:05 PM, Peter Geoghegan wrote:
> On Thu, Aug 28, 2014 at 7:29 AM, Andreas Karlsson <andreas@proxel.se> wrote:
>> Personally I would find it surprising if RETURNING did not also return the
>> updated tuples. In many use cases for upsert the user does not care if the
>> row was new or not.
>
> I'm not attached to that particular behavior, but it does seem kind of
> similar to the behavior of BEFORE triggers, where a NULL return value
> ("do nothing") will also cause RETURNING to not project the tuple.

I see. So we have three cases where we may or may not want to project a 
tuple.

1) The tuple was inserted
2) We got a conflict and updated the tuple
3) We got a conflict but skipped updating the tuple

My personal intuition was that (1) and (2) would be returned but not 
(3). But I am not sure if that is the most useful behavior.

-- 
Andreas Karlsson



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Per table autovacuum vacuum cost limit behaviour strange