Re: BUG #5719: Constraint Problem - Mailing list pgsql-bugs

From Alex Hunsaker
Subject Re: BUG #5719: Constraint Problem
Date
Msg-id AANLkTikm8NXG_FpFVUsJhH1zyjBw4Y2bkAgWi6ACYDda@mail.gmail.com
Whole thread Raw
In response to BUG #5719: Constraint Problem  ("KOTAPATI.KRISHNAIAH" <kotapati.krishna@hotmail.com>)
Responses Re: BUG #5719: Constraint Problem
List pgsql-bugs
On Thu, Oct 21, 2010 at 03:05, KOTAPATI.KRISHNAIAH
<kotapati.krishna@hotmail.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference: =C2=A0 =C2=A0 =C2=A05719
> Logged by: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KOTAPATI.KRISHNAIAH
> Email address: =C2=A0 =C2=A0 =C2=A0kotapati.krishna@hotmail.com
> PostgreSQL version: PostgreSQL8.3.1
> Operating system: =C2=A0 Microsoft Windows [Version 6.1.7600]
> Description: =C2=A0 =C2=A0 =C2=A0 =C2=A0Constraint Problem
> Details:
>
> create table kittu1 as select * from kota1; =C2=A0when i use this command=
 ,i got
> the following details:

I may have misunderstood the problem, I dont see a bug here.  Im
assuming you want kittu1 to have the constraints that kota1 has.
create table ... as select ... won't work simply because the the
select does not have the information needed.

Try:
create table kittu1 (like kota1 including constraints including
defaults including indexes);
insert into kittu1 select * from kota1;

Or if you just want the not null constraints:
create table kittu1 (like kota1 including constraints);

See http://www.postgresql.org/docs/8.3/static/sql-createtable.html for more.
[ note it looks like with postgresql 9.0 and up you can just say like
kota1 including all ]

pgsql-bugs by date:

Previous
From: "KOTAPATI.KRISHNAIAH"
Date:
Subject: BUG #5719: Constraint Problem
Next
From: andreas
Date:
Subject: Re: BUG #5705: btree_gist: Index on inet changes query result