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

Поиск
Список
Период
Сортировка
От Anssi Kääriäinen
Тема Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Дата
Msg-id 1417760835.22478.80.camel@TTY32
обсуждение исходный текст
Ответ на Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}  (Peter Geoghegan <pg@heroku.com>)
Ответы Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}  (Peter Geoghegan <pg@heroku.com>)
Список pgsql-hackers
On Thu, 2014-12-04 at 10:27 -0800, Peter Geoghegan wrote:

> I think that the standard for adding a new system attribute ought to
> be enormous. The only case where a new one was added post-Postgres95
> was "tableoid". I'm pretty sure that others aren't going to want to do
> it that way. Besides, I'm not entirely convinced that this is actually
> an important distinction to expose.

For Django's use case this is a requirement. We must inform the user if
the save() action created a new row or if it modified an existing one.

Another way to do this would be to expose the "excluded" alias in the
returning clause. All columns of the excluded alias would be null in
the case of insert (especially the primary key column), and thus if a
query   insert into foobar values(2, '2') on conflict (id) update set other_col=excluded.other_col returning
excluded.id
returns a non-null value, then it was an update.
- Anssi





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

Предыдущее
От: Adam Brightwell
Дата:
Сообщение: check-world failure: dummy_seclabel
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: On partitioning