Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YvF2M-0005l5-J5 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2015 01:12:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YvF2L-0004nh-Hp for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2015 01:12:37 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YvF2K-0004nZ-1c for pgsql-hackers@postgresql.org; Thu, 21 May 2015 01:12:36 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1YvF2H-0000AD-6i for pgsql-hackers@postgresql.org; Thu, 21 May 2015 01:12:34 +0000 Received: from intern.anarazel.de (unknown [184.23.178.130]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id D5BD8860001; Thu, 21 May 2015 03:12:31 +0200 (CEST) Date: Thu, 21 May 2015 03:12:29 +0200 From: Andres Freund To: Peter Geoghegan Cc: Alvaro Herrera , Pg Hackers Subject: Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE. Message-ID: <20150521011229.GX27868@alap3.anarazel.de> References: <20150520215816.GI5885@postgresql.org> <20150520220911.GK5885@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2015-05-20 15:21:49 -0700, Peter Geoghegan wrote: > On Wed, May 20, 2015 at 3:14 PM, Peter Geoghegan 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. > 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: You realize there's other instances of this in the same damn function? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers