Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcyJ9-0005ml-A0 for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Aug 2017 18:23:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dcyJ8-0003Lp-NZ for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Aug 2017 18:23:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dcyIO-00021X-1d for pgsql-bugs@postgresql.org; Wed, 02 Aug 2017 18:23:00 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dcyIL-00020o-8o for pgsql-bugs@postgresql.org; Wed, 02 Aug 2017 18:22:58 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 3AB5E20C73; Wed, 2 Aug 2017 14:22:56 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Wed, 02 Aug 2017 14:22:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=huW39OIzmOZsJmOwp45XazGqL7k+VY3YpNuIzrDZ/Lo=; b=iNe1LQum rXB1ASVoWXaGlao/PVodGJagPwcdixam0Tvh6Ey/WcZpEyfCwtMJ9ZuLoVPZ4TiR dvDEjqo5+IkCQLcXZGPPTzPLQ1+0+uXoDa+xBQRaj3ROOLpHqgCPKpFaX9PQzxHo cLYbqJ2u/Yv19cu0VVw7fOtwYio474Q1eLG9iEa/I0pfrDs2VtEPcNBvodyGZsaY 41yc9py64WL+GuhaxH/g7p1XLwJZUKF8QMrsePHJ+m1hHfIo5Mb8bBP9TgYHQesi qBpkGGcDrt5OeU9m72VZmEqT60IfvcnGFev5TkRqvqR9KIEDMzgCSyirarNqMBbN 5ZJxLK+iJ/vxUg== X-ME-Sender: X-Sasl-enc: TbWUljPz6nCIaU3PodENKHd3vNUPCEgdW84VEnvV6GhW 1501698176 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id E9F087E4A9; Wed, 2 Aug 2017 14:22:55 -0400 (EDT) Subject: Re: BUG #14756: Inserting row with PK IDENTITY column fails 1st time To: zam6ak@gmail.com, pgsql-bugs@postgresql.org References: <20170724012517.1455.83097@wrigleys.postgresql.org> From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <0ddc33be-4961-673e-331f-9e98a37f3f79@2ndquadrant.com> Date: Wed, 2 Aug 2017 14:22:55 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170724012517.1455.83097@wrigleys.postgresql.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 7/23/17 21:25, zam6ak@gmail.com wrote: > The following bug has been logged on the website: > > Bug reference: 14756 > Logged by: zam zam > Email address: zam6ak@gmail.com > PostgreSQL version: 10beta2 > Operating system: docker for windows 17.06 ce > Description: > > - table with PK IDENTITY COLUMN > - insert 1st row and specify PK value (OVERRIDING) > - insert 2nd row using defaults (fails) > - try same command again (succeeds) > > The failure is only on the 1st attempt. This is working correctly, AFAICT. When you insert an explicit value into the identity column, the sequence is not advanced. > -- but now, neither of these works ("ERROR: duplicate key value violates > unique constraint "audit_pk"") > -- THEY ONLY DON"T WORK 1st TIME you try (either statement), > -- on 2nd attept each succeeds (My guess 1st time sequence is > updated/corrected so 2nd time it goes through) That is correctly observed. > INSERT INTO public.audit VALUES (DEFAULT, 'public.audit'::regclass, > 'public', 'audit'); > INSERT INTO public.audit (relation_id, schema_name, table_name) VALUES > ('public.audit'::regclass, 'public', 'audit'); -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs