NOT NULL Fixes - Mailing list pgsql-patches

From Rod Taylor
Subject NOT NULL Fixes
Date
Msg-id 1039096174.36626.62.camel@jester
Whole thread Raw
Responses Re: NOT NULL Fixes  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: NOT NULL Fixes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Enforces NOT NULL constraints to be applied against new PRIMARY KEY
columns in DefineIndex.  So, ALTER TABLE ... PRIMARY KEY will now
automatically add the NOT NULL constraint.  It appeared the alter_table
regression test wanted this to occur, as after the change the regression
test better matched in inline 'fails'/'succeeds' comments.

At first glance, I didn't see any documentation that said this did not
happen.

It's not as efficient as it could be for multi-key primary keys, but
it's certainly better than the old method.  Besides, how often do you
alter in a multi-key primary key on a table with lots of data.


It also corrects the inheritance case:

b=# create table a (aa int4);
CREATE TABLE
b=# create table b (bb int4, primary key(aa, bb)) inherits (a);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 'b_pkey'
for table 'b'
CREATE TABLE
b=# \d b
       Table "public.b"
 Column |  Type   | Modifiers
--------+---------+-----------
 aa     | integer | not null
 bb     | integer | not null
Indexes: b_pkey primary key btree (aa, bb)


The NOT NULL clause will NOT cascade to children at the moment.  Perhaps
this should be the other way around?

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachment

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: doc update
Next
From: Tom Lane
Date:
Subject: Re: Hierarchical queries a la Oracle patch. for 7.3rc1.