Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YvZtX-0006QU-2p for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2015 23:28:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YvZtW-0001vY-65 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2015 23:28:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YvZtU-0001vJ-NH for pgsql-hackers@postgresql.org; Thu, 21 May 2015 23:28:52 +0000 Received: from mail-qk0-f180.google.com ([209.85.220.180]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1YvZtQ-000055-Ln for pgsql-hackers@postgresql.org; Thu, 21 May 2015 23:28:51 +0000 Received: by qkgx75 with SMTP id x75so1679091qkg.1 for ; Thu, 21 May 2015 16:28:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=8mDFUmLjmOVFrz/Y/WHecxto+fhQZ1Np5R1bBYkG3sI=; b=g1ksT9txHcFql4xosiIeltj/TIdK9YB1qeT6QeyUXLpGz4Hu/Wg3bTkEO4WSdvFIdN F/YYqFhn0F4LJLLMVKs6BT+HzsaTBKX7gi+hkkExye/Axecnp31lszUTJmWlk2bPoc9t dYfHEApDABaFRhpSWZf+gWBR18ozS9FfKe/2ic9DSNbYq6ZzpeDYXd7lFyvZ36/xk0Fj 2LutDIo9I5BQgV8MZEXA2V65Jf3kozErWGJwJeDzmXVCuVAJl/MmortyRB5cSptgKYe2 RMXW6M7xAIGiIKhUM9PJXj92BoMkdwfzZthESqVSLTx24O/me4wlpyfayjlDMRny7Tw0 AcRg== X-Gm-Message-State: ALoCoQn7i4Ge13X/eyTNW3N52eNHko7+NaNcRSwaZsd9JtTOBmgWU+WGiPLjOx4RnTxfwCU+WrnE X-Received: by 10.140.150.78 with SMTP id 75mr7784641qhw.10.1432250925749; Thu, 21 May 2015 16:28:45 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([181.42.249.21]) by mx.google.com with ESMTPSA id 18sm247428qgf.4.2015.05.21.16.28.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 16:28:45 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id BFE35541; Thu, 21 May 2015 20:28:41 -0300 (CLT) Date: Thu, 21 May 2015 20:28:41 -0300 From: Alvaro Herrera To: Andres Freund Cc: Tom Lane , Peter Geoghegan , Pg Hackers Subject: Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE. Message-ID: <20150521232841.GO5885@postgresql.org> References: <20150520215816.GI5885@postgresql.org> <20150520220911.GK5885@postgresql.org> <20150521011229.GX27868@alap3.anarazel.de> <10660.1432171328@sss.pgh.pa.us> <20150521013059.GY27868@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150521013059.GY27868@alap3.anarazel.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.6 (--) 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 Andres Freund wrote: > On 2015-05-20 21:22:08 -0400, Tom Lane wrote: > > Not to mention that several places in libpq/fe-exec.c should be > > taught about this new tag. And who-knows-what in other client-side > > libraries. 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? > > > > I think we should fix this by ripping out the variant tag, not trying > > to propagate it everywhere it would need to go. Cute ideas are not > > the same as good ideas. > > I'm not particularly worried about conflicting with a potential future > UPSERT command. But I do see no corresponding benefit in having a > differerent command tag, so I'm inclined to agree that ripping it out is > likely the best way forward. > > On the other hand, this was noticed because Alvaro just argued that it > *should* have a new command tag. Alvaro, where do you see the advantage? Well, I was just skimming nearby code and noticed that CreateCommandTag hadn't been updated. As I said elsewhere, I'm not even running commands. I'm not really set on having the tag be different. That said, I'm not sure about having it be the same, either: first, I don't think we need to update the fe-exec.c code at all -- I mean, all the things I see there are very old compatibility stuff; reporting the OID of the just-inserted row? Seriously, who has OIDs in user tables anymore? Surely we wouldn't try to do that for INSERT ON CONFLICT DO UPDATE at all ... if anyone wants that functionality, they can use RETURNING, which is far saner. As for PQcmdTuples, what would a single number returned mean? Are we returning the sum of both inserted and updated tuples? Isn't this a bit odd? If the number is useful, then perhaps we should distinguish the cases; and if it's not useful, why not just return zero? -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers