pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@heroku.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.
Date: Wed, 20 May 2015 15:21:49 -0700
Message-ID: <CAM3SWZT0Rex4CpZo+re_m2Dh7wunMNsbD-9ZSWWx=JSewW3OVg@mail.gmail.com> (raw)
In-Reply-To: <CAM3SWZQXP3Z=iXQ_+HwoqG7417JYf6HKDTmgk-4Xt05OEL_S_Q@mail.gmail.com>
References: <E1YqZCW-0000e6-Od@gemulon.postgresql.org>
	<20150520215816.GI5885@postgresql.org>
	<CAM3SWZRUhr1806zsF28CVRrB=b4t8PWv8d9x29z02xTQoFDyWA@mail.gmail.com>
	<20150520220911.GK5885@postgresql.org>
	<CAM3SWZQXP3Z=iXQ_+HwoqG7417JYf6HKDTmgk-4Xt05OEL_S_Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On Wed, May 20, 2015 at 3:14 PM, Peter Geoghegan <pg@heroku.com> wrote:
> I think you're right. The initial commit neglected to update that, and
> only handled it from ProcessQuery(). So it works for PlannedStmts, not
> raw parse trees.

Attached patch fixes this. Thanks for the report.

-- 
Peter Geoghegan

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

Attachments:

commandtag-bug.patch (text/x-patch, 536B) download diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index a95eff1..8fd5ee8 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -1898,7 +1898,14 @@ CreateCommandTag(Node *parsetree) { /* raw plannable queries */ case T_InsertStmt: - tag = "INSERT"; + { + InsertStmt *stmt = (InsertStmt *) parsetree; + + tag = "INSERT"; + if (stmt->onConflictClause && + stmt->onConflictClause->action == ONCONFLICT_UPDATE) + tag = "UPSERT"; + } break; case T_DeleteStmt:

view thread (32+ messages)  latest in thread

Message-ID: <CAM3SWZT0Rex4CpZo+re_m2Dh7wunMNsbD-9ZSWWx=JSewW3OVg@mail.gmail.com>
Permalink:  ../CAM3SWZT0Rex4CpZo+re_m2Dh7wunMNsbD-9ZSWWx=JSewW3OVg@mail.gmail.com/
Also on:    postgresql.org/message-id/CAM3SWZT0Rex4CpZo+re_m2Dh7wunMNsbD-9ZSWWx=JSewW3OVg@mail.gmail.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: pg@heroku.com, alvherre@2ndquadrant.com, andres@anarazel.de, pgsql-hackers@postgresql.org
  Subject: Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.
  In-Reply-To: <CAM3SWZT0Rex4CpZo+re_m2Dh7wunMNsbD-9ZSWWx=JSewW3OVg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox