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