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 inserted after primary > key > > constraint has been dropped. > > 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 the removal of the not null entry from their corresponding pg_attribute rows. > but I'm not really sure there's much point, since the situation is > rare and the workaround is easy. > Yeah and it is documented already. Although it is not obvious immediately that a not-null attribute gets tagged onto the involved columns separately for primary, unique-not-null types of constraints. Regards, Nikhils -- http://www.enterprisedb.com