Re: CREATE TABLE LIKE, regarding constraints
От | Magnus Hagander |
---|---|
Тема | Re: CREATE TABLE LIKE, regarding constraints |
Дата | |
Msg-id | CABUevEy-+Tszne6SgkHm05dyRkPV0tVGRqTT=Dj9G7Fe9gfFwQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: CREATE TABLE LIKE, regarding constraints (<david.sahagian@emc.com>) |
Ответы |
Re: CREATE TABLE LIKE, regarding constraints
|
Список | pgsql-docs |
On Mon, Jan 2, 2012 at 15:32, <david.sahagian@emc.com> wrote: > On Fri, Dec 30, 2011 at 22:27, <david.sahagian@emc.com> wrote: >> www.postgresql.org/docs/9.0/static/sql-createtable.html >> == == == == == >> LIKE parent_table [ like_option ... ] >> . . . >> Not-null constraints are always copied to the new table. >> CHECK constraints will only be copied if INCLUDING CONSTRAINTS is specified; other types of constraints will never becopied. >> . . . >> == == == == == >> >> But I do see PK and UNIQUE constraints >> CONSTRAINT blah_pkey PRIMARY KEY (id), >> CONSTRAINT blah_host_id_key UNIQUE (host_id) >> in the def of the new table. > > Can you provide the commands you ran to make that happen? It doesn't > happen for me in a trivial test. > >> Also, why is there no discussion of what "EXCLUDING CONSTRAINTS" will result in ? > > > Magnus, > I did some more "testing" of CREATE TABLE LIKE, > and now see that [INCLUDING INDEXES] also can cause PRIMARY KEY and UNIQUE constraints to become part of the new table. Ah, that explains why I couldn't reproduce it. > I have no problem with this behavior, > but the doc probably deserves some clarification on the "relationship" between > [INCLUDING CONSTRAINTS] and [INCLUDING INDEXES]. That might be a good idea, yes. Feel like cooking up a patch? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
В списке pgsql-docs по дате отправления: