pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: mroscio@tin.it
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14346: CREATE TABLE xxx (LIKE yyy INCLUDING ALL) fails
Date: Thu, 29 Sep 2016 08:59:00 -0400
Message-ID: <4645.1475153940@sss.pgh.pa.us> (raw)
In-Reply-To: <20160929113732.20224.74918@wrigleys.postgresql.org>
References: <20160929113732.20224.74918@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (4+ messages)  latest in thread

Message-ID: <4645.1475153940@sss.pgh.pa.us>
Permalink:  ../4645.1475153940@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4645.1475153940@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mroscio@tin.it
  Subject: Re: BUG #14346: CREATE TABLE xxx (LIKE yyy INCLUDING ALL) fails
  In-Reply-To: <4645.1475153940@sss.pgh.pa.us>
  References: <20160929113732.20224.74918@wrigleys.postgresql.org> <4645.1475153940@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox