Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-07 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > Nikhil Sontakke wrote: > >> Warrants an entry in the TODO items list: > >> > >> * make NOT NULL constraints have pg_constraint entries, just like CHECK > >> constraints > > > This is now a TODO item (I just updated the description): > > > Store th

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-07 Thread Tom Lane
Bruce Momjian writes: > Nikhil Sontakke wrote: >> Warrants an entry in the TODO items list: >> >> * make NOT NULL constraints have pg_constraint entries, just like CHECK >> constraints > This is now a TODO item (I just updated the description): > Store the constraint names of NOT NULL con

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-07 Thread Bruce Momjian
Nikhil Sontakke wrote: > Hi, > > > > We've discussed before the idea that NOT NULL constraints should be > > explicitly represented in pg_constraint, just like general CHECK > > constraints (this would allow them to be named, have sane inheritance > > behavior, etc). If we had that, then pg_attr

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-03 Thread Nikhil Sontakke
Hi, > We've discussed before the idea that NOT NULL constraints should be > explicitly represented in pg_constraint, just like general CHECK > constraints (this would allow them to be named, have sane inheritance > behavior, etc). If we had that, then pg_attribute.attnotnull could > indicate the

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-02 Thread Tom Lane
Robert Haas writes: > Actually it's more complicated than that. You'd need to remember > whether or not the NOT NULL was added when the primary key was added, > or whether it was there before, and only drop it if it wasn't there > before. We've discussed before the idea that NOT NULL constraints

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-02 Thread Nikhil Sontakke
Hi, > >> > >> Making a column into the primary key forces the column to NOT NULL. > >> You'll need to DROP NOT NULL separately. > >> > >> It's probably possible to beat on the code hard enough to fix this, > > > > Yeah it will be a matter of finding the affected column entries and > invoking > > t

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-02 Thread Robert Haas
On Thu, Apr 2, 2009 at 8:24 AM, Nikhil Sontakke wrote: > Hi, >> >> > Considering the following sequence: >> >    create table t(a int primary key); >> >    alter table t drop constraint t_pkey; >> >    insert into t values(null); >> >    ERROR:  null value in column "a" violates not-null constrain

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-02 Thread Nikhil Sontakke
Hi, > > Considering the following sequence: > >create table t(a int primary key); > >alter table t drop constraint t_pkey; > >insert into t values(null); > >ERROR: null value in column "a" violates not-null constraint > > > > My question is, why "null" is not allowed to be inserte

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-02 Thread Robert Haas
On Thu, Apr 2, 2009 at 3:25 AM, Jacky Leng wrote: > Considering the following sequence: >    create table t(a int primary key); >    alter table t drop constraint t_pkey; >    insert into t values(null); >    ERROR:  null value in column "a" violates not-null constraint > > My question is, why "nu

[HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-02 Thread Jacky Leng
Considering the following sequence: create table t(a int primary key); alter table t drop constraint t_pkey; insert into t values(null); ERROR: null value in column "a" violates not-null constraint My question is, why "null" is not allowed to be inserted after primary key constra