Re: BUG #11381: Inherited NOT NULL to NULLABLE column: backup restore error. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #11381: Inherited NOT NULL to NULLABLE column: backup restore error.
Date
Msg-id 2680.1410191279@sss.pgh.pa.us
Whole thread Raw
In response to BUG #11381: Inherited NOT NULL to NULLABLE column: backup restore error.  (m.winkel@w2solutions.nl)
List pgsql-bugs
m.winkel@w2solutions.nl writes:
> CREATE TABLE base
> (
>   id serial NOT NULL,
>   name character varying(127) NOT NULL,
>   nickname character varying(127) NOT NULL,
>   email_address character varying(512) NOT NULL,
>   useless_but_required_field text NOT NULL,
>   CONSTRAINT base_pkey PRIMARY KEY (id)
> )
> WITH (
>   OIDS=FALSE
> );

> CREATE TABLE inherited
> (
>   CONSTRAINT inherited_pkey PRIMARY KEY (id)
> )
> INHERITS (base)
> WITH (
>   OIDS=FALSE
> );

> ALTER TABLE inherited
>    ALTER COLUMN useless_but_required_field DROP NOT NULL;

IMO this should definitely be disallowed.  But we lack the catalog
infrastructure to do so conveniently.  There has been some work
towards representing NOT NULL constraints more like CHECK constraints,
which do have the required infrastructure.  Once that's finished,
you'll probably see this be rejected.  There's not much point in
trying to make pg_dump cope with it, I think.

            regards, tom lane

pgsql-bugs by date:

Previous
From: m.winkel@w2solutions.nl
Date:
Subject: BUG #11381: Inherited NOT NULL to NULLABLE column: backup restore error.
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #10528: MAC OS X was renamed