Re: CREATE LIKE INCLUDING COMMENTS and STORAGES - Mailing list pgsql-hackers

From Khee Chin
Subject Re: CREATE LIKE INCLUDING COMMENTS and STORAGES
Date
Msg-id 797115b80910040710h4fa53a89s1eba12e391988cdd@mail.gmail.com
Whole thread Raw
In response to Re: CREATE LIKE INCLUDING COMMENTS and STORAGES  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: CREATE LIKE INCLUDING COMMENTS and STORAGES  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
List pgsql-hackers
Recently, I encountered a situation where the docs on (or impl?)
INCLUDING INDEXES and INCLUDING CONSTRAINTS are not clearly defined
for primary keys. Should it be noted in the docs that in this case, we
are referring to the technical implementation of a primary key, i.e. a
unique index and a not null constraint, thus both conditions are
required?

testdb=> CREATE TABLE foo (id int primary key);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"foo_pkey" for table "foo"
CREATE TABLE
testdb=> \d foo;     Table "public.foo"Column |  Type   | Modifiers
--------+---------+-----------id     | integer | not null
Indexes:   "foo_pkey" PRIMARY KEY, btree (id)

testdb=> CREATE TABLE foo2 (LIKE FOO INCLUDING CONSTRAINTS EXCLUDING INDEXES);
CREATE TABLE
testdb=> \d foo2    Table "public.foo2"Column |  Type   | Modifiers
--------+---------+-----------id     | integer | not null

testdb=> CREATE TABLE foo3 (LIKE FOO EXCLUDING CONSTRAINTS INCLUDING INDEXES);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"foo3_pkey" for table "foo3"
CREATE TABLE
testdb=> \d foo3;    Table "public.foo3"Column |  Type   | Modifiers
--------+---------+-----------id     | integer | not null
Indexes:   "foo3_pkey" PRIMARY KEY, btree (id)

testdb=>


Regards,
Khee Chin.


pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: Using results from INSERT ... RETURNING
Next
From: Tom Lane
Date:
Subject: Re: Getting the red out (of the buildfarm)