Re: [GENERAL] I think this is a BUG? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [GENERAL] I think this is a BUG?
Date
Msg-id 209.1209054435@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] I think this is a BUG?  ("Brendan Jurd" <direvus@gmail.com>)
Responses Re: [GENERAL] I think this is a BUG?  ("Brendan Jurd" <direvus@gmail.com>)
Re: [GENERAL] I think this is a BUG?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Brendan Jurd" <direvus@gmail.com> writes:
> transformIndexConstraint sets the is_not_null flag on the ColumnDefs
> associated with the primary key.  That works great in a CREATE TABLE
> context, but in ADD COLUMN, when we haven't created the column yet,
> this means that the column is created with attnotnull set to true,
> which tricks DefineIndex into thinking that the column already has a
> NOT NULL constraint.

Huh?  The attnotnull bit *is* the constraint, there is no other
representation.  (There has been talk of making a pg_constraint
entry but it isn't done today.)

I think the bug here is that ADD COLUMN NOT NULL has to fail if
there's not a default expression supplied (except maybe we could
allow it if the table contains no rows).  ISTM we got this right
in the past, wonder why it's not working now ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Decibel!
Date:
Subject: Re: Index AM change proposals, redux
Next
From: Tom Lane
Date:
Subject: Re: Proposed patch - psql wraps at window width