From: | Alex Hunsaker <badalex(at)gmail(dot)com> |
---|---|
To: | "KOTAPATI(dot)KRISHNAIAH" <kotapati(dot)krishna(at)hotmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #5719: Constraint Problem |
Date: | 2010-10-22 17:38:23 |
Message-ID: | AANLkTinktr5=x3sduKzSfSpkZJBSqk3J=2=3oupLaKnb@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Oct 21, 2010 at 12:03, Alex Hunsaker <badalex(at)gmail(dot)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(dot)krishna(at)hotmail(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Alexia Lau | 2010-10-23 01:56:59 | BUG #5721: EnterpriseDB linux one-click installer missing libuuid.so.16 |
Previous Message | Tom Lane | 2010-10-22 17:11:25 | Re: BUG #5720: Bug for PQescapeByteaConn (libpq) |