On 05/21/2015 05:08 AM, Peter Geoghegan wrote:
> On Wed, May 20, 2015 at 6:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I am not really sure that it was a good idea to invent
>> this command tag. In fact, I'm pretty sure it was a *bad* idea ---
>> what will happen if we ever create a statement actually named UPSERT?
>
> Why would we invent a statement actually named UPSERT?
And if we did, surely it would do some sort of an upsert operation, we
could use the UPSERT command tag for that too.
That said, I'm also not sure adding the UPSERT command tag is worth the
trouble. I'm OK with ripping it out. The row count returned in the
command tag is handy in the simple cases, but it gets complicated as
soon as you have rules or triggers, so you can't rely much on it anyway.
So as long as we document what the count means for an INSERT ... ON
CONFLICT, it should be OK to use the INSERT tag.
- Heikki