Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5bwf-0001WM-09 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Dec 2014 15:09:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y5bwd-0001eO-Qe for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Dec 2014 15:09:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y5bwc-0001eC-Hn for pgsql-hackers@postgresql.org; Mon, 29 Dec 2014 15:09:18 +0000 Received: from nm17-vm3.bullet.mail.ne1.yahoo.com ([98.138.91.147]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y5bwY-0004TD-95 for pgsql-hackers@postgresql.org; Mon, 29 Dec 2014 15:09:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1419865751; bh=5h8TJ0p2fbweK/CDhpnpMnWXO/KR8JWDsbY4IcYT0/o=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=mB33sKL7dGtuBBSfPbt0SKUDuMuptWOwj5MuAzXWHK21jfSS/XFTSkReU/LOxtnnMkIsWjwqNnpYUCkX1HrKQ09YSvyBTNYVNcUlJh27dkpU5PJcZRqNPBY8w5t+FeRMvfCqO0eO5C6FxJcDcWl067aBk49ZmC6l+f4AYz6RBZhqDjqnYBZLEEAVlvQI6kWDtKuxCkVENTSvA30gl8k6+OBsn4dqJR8FpBWn/wHMbLmc9+tXN4CuMTIE3gNnb8qVoFSd/rOAk1+xSqPLokdzdf5AAG/JdCxKCShstcoP0EiK9i/U3GxAVolieBCMYOdGGtKvLV/z/8QXUtGY24bksg== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=ymail.com; b=hqye8oesRTdSG7Pmu+wKb/KMjU1a8ELTWkes60ZPSS8m4nqu2kh3t5jBWLQf6piknf7SW3GsxFnjhL7pMPERoBpFki9I8nrOVT5uCF4K07KyzbERsKhFmgdlyuSipl6tN/22g+GWs6/ugooVCYe4UWLTzB0qJsTNHSo6E79oZxJuPOu9y8Yj2+cO3QSNAPV7TfShw9xQSOh54qVW2OND30EagWIkh8CFbSxC8qrTSDnpum/Ajty7oqpdYpmTVAzPxPxGF4wlq3QytjIpSrbu78Yqz+FDaF++rLd3oi5hocoymnFvBsVcsEn36Cibg5V/k9W4kK2k2D6EI7978vRYdg==; Received: from [98.138.100.114] by nm17.bullet.mail.ne1.yahoo.com with NNFMP; 29 Dec 2014 15:09:11 -0000 Received: from [98.138.89.196] by tm105.bullet.mail.ne1.yahoo.com with NNFMP; 29 Dec 2014 15:09:11 -0000 Received: from [127.0.0.1] by omp1054.mail.ne1.yahoo.com with NNFMP; 29 Dec 2014 15:09:11 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 871005.76254.bm@omp1054.mail.ne1.yahoo.com X-YMail-OSG: jUgfEeQVM1kiS8vfKId2Rm5E_L_OWEFC9cplCVYuWImCBC8duYVh2JbgRS7Wlnj jwIuYEM7ahIg748uwQTQL4hRDPW0IyRJhUkV7p6hmmRmiNO_aQZ28gYbnOP6A5yhf3XZxaj9iabQ XVYr7n66tj06K.jab.DCPfSLjx3rZX10lz3SR1FMo61PN379eKneHJyoHkcV1M_9IXMj8hf9Urbp dmyqsLVBqzryTKDfsIZZYcbfItBjG0UYSPdT0YpfYdCaTXF2ogbk.ZV5dCXBBBU6SdIAne_63dIB 1XArk5EPyYuhwc0p9G6IERpysu6wOgh.03o4gErWZYdUR5466kaoDcaVRhbNAjVwWzJ__4vFBFrL dPn7YBt4cdSvsBvfHQHJ.dvVli8qsZ50g92_antdj5GQMzunxlEQqxQZs1a7_EFoC4s3W7sQpDKh MW0ryx9LMrFru421YYHS57N7BKWKvpQKkc5vrDbXMR9PN94LOIF.ut.8jSiVbFAYwr6WxSNRD8X5 HUD2AaB_HRm6PYF_lqJDBk1UqZDk5MFVCY4TFU2slUvgb7Db1XBpKWLwzsYY- Received: by 98.138.101.169; Mon, 29 Dec 2014 15:09:11 +0000 Date: Mon, 29 Dec 2014 15:09:09 +0000 (UTC) From: Kevin Grittner Reply-To: Kevin Grittner To: Merlin Moncure Cc: Tom Lane , Josh Berkus , "nikita.y.volkov@mail.ru" , "pgsql-hackers@postgresql.org" Message-ID: <534827646.1373406.1419865749409.JavaMail.yahoo@jws100110.mail.ne1.yahoo.com> In-Reply-To: References: Subject: Re: BUG #12330: ACID is broken for unique constraints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Length: 1625 X-Pg-Spam-Score: -2.0 (--) 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 Merlin Moncure wrote: > Well, I'm arguing that duplicate key errors are not serialization > failures unless it's likely the insertion would succeed upon a retry; > a proper insert, not an upsert. If that's the case with what you're > proposing, then it makes sense to me. But that's not what it sounds > like...your language suggests AIUI that having the error simply be > caused by another transaction being concurrent would be sufficient to > switch to a serialization error (feel free to correct me if I'm > wrong!). > > In other words, the current behavior is: > txn A,B begin > txn A inserts > txn B inserts over A, locks, waits > txn A commits. B aborts with duplicate key error > > Assuming that case is untouched, then we're good! My long winded > point above is that case must fail with duplicate key error; a > serialization error is suggesting the transaction should be retried > and it shouldn't be...it would simply fail a second time. What I'm proposing is that for serializable transactions B would get a serialization failure; otherwise B would get a duplicate key error. If the retry of B looks at something in the database to determine what it's primary key should be it will get a new value on the retry, since it will be starting after the commit of A. If it is using a literal key, not based on something changed by A, it will get a duplicate key error on the retry, since it will be starting after the commit of A. It will either succeed on retry or get an error for a different reason. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers