Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUHti-0004t3-Me for pgsql-bugs@arkaria.postgresql.org; Wed, 27 Dec 2017 20:01:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUHth-0007VB-Le for pgsql-bugs@arkaria.postgresql.org; Wed, 27 Dec 2017 20:01:53 +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 1eUHth-0007V1-56 for pgsql-bugs@lists.postgresql.org; Wed, 27 Dec 2017 20:01:53 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eUHta-00024z-6F for pgsql-bugs@postgresql.org; Wed, 27 Dec 2017 20:01:51 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 8297220F9E; Wed, 27 Dec 2017 15:01:44 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 27 Dec 2017 15:01:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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; s=fm1; bh=uD1ZVr EMwa4ocXYhMoRFJsuoA/CEKXAUJc3Z76G6xr4=; b=CZe91wHZJeOxpIk4+XCbK8 l76wV9evwr+MKJojIYHqHmUwgT0L70ysyJ89V1i9Jmv2qGZa9DwtGk0MbHZUQEWY 0t0sPV6aldrUH1ryIk0XO0CHnTO9WVW8ZwhYD3DoAoTNkB7uKCZfnt54Pzg1FPcQ 0E+4MH1IHwrdCrsSHH2oqjgc2KeUSQ1adZ1KFMMH+JVsmPmPsgld286KMvB7/ohW e7yHYuJvRV6P37+AxiOTYsVEYs9sqhzut+oPAne1QnY+C7yqel3XETY4Lj1NCw/d enDH9Fer0FcR3x51bPT/Bv/JWoaq7S7MWNSPH/WEci8vSWW1joZBs5nu7Ui8IoNQ == X-ME-Sender: 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 1CDFC243B8; Wed, 27 Dec 2017 15:01:44 -0500 (EST) Subject: Re: BUG #14952: COPY fails to fill in IDENTITY column default value To: Michael Paquier References: <20171207112930.21696.79944@wrigleys.postgresql.org> <12618e2c-0eb0-3e15-c45d-96891c52eb5f@2ndquadrant.com> <31740.1513222740@sss.pgh.pa.us> <21a6da72-fb24-4b9e-d300-7439425f7492@2ndquadrant.com> Cc: Tom Lane , steven.winfield@cantabcapital.com, PostgreSQL mailing lists From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Wed, 27 Dec 2017 15:01:37 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/18/17 00:49, Michael Paquier wrote: > I have a problem with this approach which is basically something > similar to what I complained in the thread about typed and partition > tables for identity columns > (https://www.postgresql.org/message-id/20171023074458.1473.25799@wrigleys.postgresql.org). > In my opinion, this ALTER TABLE handling should be done by treating > identity columns a way similar to default expressions in > transformColumnDefinition(), by storing the FuncExpr node at parsing > time instead of storing the information needed to rebuild it when > executing the query. In short the mapping should get closer to what > default does with nextval or serial. The serial case works because it stores the sequence *name* in the default value in the catalog. That doesn't work because for the identity case we don't store the expression in the catalog. The proposed patch works by storing the sequence *name* in the internal structures so that it can be used in place of the stored default value. So I think this approach is pretty consistent. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services