On Sun, Mar 24, 2024 at 11:14 AM Peter J. Holzer <hjp-pgsql@xxxxxx> wrote:
It doesn't. Your statement
> CREATE TABLE test1
> (
> c1 numeric NULL ,
> c2 varchar(36) NOT NULL ,
> CONSTRAINT test1_PK PRIMARY KEY (c1,c2)
> ) ;
creates the table with both columns being defined as NOT NULL:
The request is a warning when defining a multi-column table constraint primary key if any of the columns comprising said PK are not defined already to be NOT NULL.
Personally, green field at least, I find that to be reasonable. Especially if we are altering catalog metadata to define the columns to be not null, as opposed to say the case when a check constraint has a "col is not null" condition that could never pass even though the column itself is null-able.
David J.