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
    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

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to