Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yq5MG-0004Uy-Sy for pgsql-hackers@arkaria.postgresql.org; Wed, 06 May 2015 19:51:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yq5MG-0006nf-Du for pgsql-hackers@arkaria.postgresql.org; Wed, 06 May 2015 19:51:52 +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 1Yq5MF-0006nZ-B4 for pgsql-hackers@postgresql.org; Wed, 06 May 2015 19:51:51 +0000 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Yq5MC-0001Ks-3X for pgsql-hackers@postgresql.org; Wed, 06 May 2015 19:51:50 +0000 Received: by widdi4 with SMTP id di4so215474254wid.0 for ; Wed, 06 May 2015 12:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:reply-to:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=ZzosMqUKshqvrVnGLpoia4HWkzovRvh4q4dGz4MIKek=; b=oCiAtCrvAsSubODBo5kAGKTpBHr5KMaueIjGLaMSMz/E9MlnBokPPmRgf0n6+aq8NG XVqZ6XQu2xDVsbNXHzk2pD2ZFkpFsvHaA5QJXqUwUxZ7OHb34ssNnEjeiiCoLrbyqynz B0HQZrJiy7+UxmbkEuodWSdeM9FqKYh1ZMqClFkfVuQyExwC8gSGCVG2N+10ZVpLJZ94 ICWJgsBQOjfkby3178x8Z5LY/bBDoklD9tmnJ+AlaEG3jXJoZZRUvf+VYz7Ck5qrnIyi YdtLsm7m4rRBnN0wf98M6UjotvcQfAlaEP0vQz4g9H0FjdC42hHKgQw6FDPaV5u5Jh8m 2sLg== X-Received: by 10.194.62.167 with SMTP id z7mr740602wjr.62.1430941906399; Wed, 06 May 2015 12:51:46 -0700 (PDT) Received: from [192.168.1.99] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by mx.google.com with ESMTPSA id a18sm4228312wja.46.2015.05.06.12.51.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 May 2015 12:51:45 -0700 (PDT) Message-ID: <554A70CF.8090608@iki.fi> Date: Wed, 06 May 2015 22:51:43 +0300 From: Heikki Linnakangas Reply-To: hlinnaka@iki.fi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: Peter Geoghegan , Andres Freund CC: Jeff Janes , Stephen Frost , Dean Rasheed , Bruce Momjian , Pg Hackers Subject: Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 References: <20150505154030.GI9855@alap3.anarazel.de> <20150506152007.GN9855@alap3.anarazel.de> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.8 (/) 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 05/06/2015 10:47 PM, Peter Geoghegan wrote: > On Wed, May 6, 2015 at 8:20 AM, Andres Freund wrote: >> On 2015-05-05 15:00:56 -0700, Peter Geoghegan wrote: >>> Locking the row is not "nothing", though. If you want to lock the row, >>> use an UPSERT with a tautologically false WHERE clause (like "WHERE >>> false"). >> >> That's not the same. For one it "breaks" RETURNING which is a death >> knell, for another it's not exactly obvious. > > DO NOTHING already doesn't project non-inserted tuples, in a way that > fits with the way we won't do that when a before trigger returns NULL. > So I don't know what you mean about RETURNING behavior. > > It may not be all that obvious, but then the requirement that you > mention isn't either. I really strongly feel that DO NOTHING should do > nothing. For the pgloader use-case, which is what I have in mind with > that variant, that could literally make the difference between > dirtying an enormous number of buffers and dirtying only a few. This > will *frequently* be the case. And it's not as if the idea of an > INSERT IGNORE is new or in any way novel. As I mentioned, many systems > have a comparable command. > > So, yes, DO NOTHING does very little - and that is its appeal. > Supporting this behavior does not short change those who actually care > about the existing tuple sticking around for the duration of their > transaction - they have a way of doing that. If you want to document > INSERT IGNORE as being primarily an ETL-orientated thing, that would > make sense, but let's not hobble that use case. 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. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers