Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpava-0004JT-Ks for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Sep 2016 12:59:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bpava-0001la-7T for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Sep 2016 12:59:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bpavZ-0001h3-Fw for pgsql-bugs@postgresql.org; Thu, 29 Sep 2016 12:59:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bpavW-0006l3-BI for pgsql-bugs@postgresql.org; Thu, 29 Sep 2016 12:59:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u8TCx0PS004646; Thu, 29 Sep 2016 08:59:00 -0400 From: Tom Lane To: mroscio@tin.it cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14346: CREATE TABLE xxx (LIKE yyy INCLUDING ALL) fails In-reply-to: <20160929113732.20224.74918@wrigleys.postgresql.org> References: <20160929113732.20224.74918@wrigleys.postgresql.org> Comments: In-reply-to mroscio@tin.it message dated "Thu, 29 Sep 2016 11:37:32 -0000" Date: Thu, 29 Sep 2016 08:59:00 -0400 Message-ID: <4645.1475153940@sss.pgh.pa.us> X-Pg-Spam-Score: -4.9 (----) 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 mroscio@tin.it writes: > When yyy has no primary keys, all constraints are duly created on xxx. > When yyy has a primary key named pk_yyy, a primary key named xxx_pkey is > created, all other constraints are lost. Works for me ... regression=# create table yyy (f1 int constraint pk_yyy primary key, f2 int unique); CREATE TABLE regression=# \d yyy Table "public.yyy" Column | Type | Modifiers --------+---------+----------- f1 | integer | not null f2 | integer | Indexes: "pk_yyy" PRIMARY KEY, btree (f1) "yyy_f2_key" UNIQUE CONSTRAINT, btree (f2) regression=# create table xxx (like yyy including all); CREATE TABLE regression=# \d xxx Table "public.xxx" Column | Type | Modifiers --------+---------+----------- f1 | integer | not null f2 | integer | Indexes: "xxx_pkey" PRIMARY KEY, btree (f1) "xxx_f2_key" UNIQUE CONSTRAINT, btree (f2) regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs