Re: BUG #5719: Constraint Problem
От | Alex Hunsaker |
---|---|
Тема | Re: BUG #5719: Constraint Problem |
Дата | |
Msg-id | AANLkTinktr5=x3sduKzSfSpkZJBSqk3J=2=3oupLaKnb@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #5719: Constraint Problem (Alex Hunsaker <badalex@gmail.com>) |
Список | pgsql-bugs |
On Thu, Oct 21, 2010 at 12:03, Alex Hunsaker <badalex@gmail.com> wrote: > Or if you just want the not null constraints: > create table kittu1 (like kota1 including constraints); Correction, the above should read: "Or, if you want check constraints". Not null constraints are always copied, and including constraints only deals with check constraints. On Thu, Oct 21, 2010 at 22:01, KOTAPATI KRISHNAIAH <kotapati.krishna@hotmail.com> wrote: [ Example shrunk ] > CREATE TABLE cons > ( > id integer NOT NULL primary key, > ); > > The above cons table already existed. > when i'm creating the above same structure of table by using below this > Query i'm not getting constraints ... > > create table vijju1(like cons including constraints); > > CREATE TABLE vijju1 > ( > id integer NOT NULL, > ); Or in other words create table like is not copying the primary key constraint. The simple answer is to use "including indexes". There is quite a bit of discussion on this, some interesting points: http://archives.postgresql.org/pgsql-hackers/2009-12/msg02018.php and a long thread with a patch...: http://postgresql.1045698.n5.nabble.com/CREATE-TABLE-LIKE-INCLUDING-INDEXES-support-td2220980.html The sad news is I dont think anything appened for 8.4 or 9.0.
В списке pgsql-bugs по дате отправления: