Re: BUG #5719: Constraint Problem

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-21 18:03:29
Message-ID: AANLkTikm8NXG_FpFVUsJhH1zyjBw4Y2bkAgWi6ACYDda@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Oct 21, 2010 at 03:05, KOTAPATI.KRISHNAIAH
<kotapati(dot)krishna(at)hotmail(dot)com> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5719
> Logged by:          KOTAPATI.KRISHNAIAH
> Email address:      kotapati(dot)krishna(at)hotmail(dot)com
> PostgreSQL version: PostgreSQL8.3.1
> Operating system:   Microsoft Windows [Version 6.1.7600]
> Description:        Constraint Problem
> Details:
>
> create table kittu1 as select * from kota1;  when 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 ]

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message andreas 2010-10-21 21:49:31 Re: BUG #5705: btree_gist: Index on inet changes query result
Previous Message KOTAPATI.KRISHNAIAH 2010-10-21 09:05:26 BUG #5719: Constraint Problem