Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yq5jp-0005pn-F0 for pgsql-hackers@arkaria.postgresql.org; Wed, 06 May 2015 20:16:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yq5jo-0006TH-ML for pgsql-hackers@arkaria.postgresql.org; Wed, 06 May 2015 20:16:12 +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 1Yq5jn-0006Sz-Hz for pgsql-hackers@postgresql.org; Wed, 06 May 2015 20:16:11 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Yq5jk-0001RJ-Ul for pgsql-hackers@postgresql.org; Wed, 06 May 2015 20:16:10 +0000 Received: from intern.anarazel.de (unknown [184.23.178.130]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 1411E860001; Wed, 6 May 2015 22:16:08 +0200 (CEST) Date: Wed, 6 May 2015 22:16:04 +0200 From: Andres Freund To: Heikki Linnakangas Cc: Peter Geoghegan , Jeff Janes , Stephen Frost , Dean Rasheed , Bruce Momjian , Pg Hackers Subject: Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 Message-ID: <20150506201604.GB12506@alap3.anarazel.de> References: <20150505154030.GI9855@alap3.anarazel.de> <20150506152007.GN9855@alap3.anarazel.de> <554A70CF.8090608@iki.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <554A70CF.8090608@iki.fi> X-Pg-Spam-Score: -2.7 (--) 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-06 22:51:43 +0300, Heikki Linnakangas wrote: > Yeah, I agree that DO NOTHING should not lock the rows. It might make sense > to have a DO LOCK variant, which locks the rows, although I don't > immediately see what the use case would be. If you want to do something more complicated with the row than what you can do in the UPDATE. To do that right now you either need to do the DO UPDATE SET ... WHERE false; and refetch the tuple which might not be easy, or do a DO UPDATE SET pkey = target.pkey which produces bloat. Consider e.g. you're applying incoming data and in case of conflict you want to call user defined function deciding which row should survive. Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers