Re: [GENERAL] I think this is a BUG?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Brendan Jurd" <direvus(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] I think this is a BUG?
Date: 2008-04-24 16:27:15
Message-ID: 209.1209054435@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

"Brendan Jurd" <direvus(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-04-24 16:36:54 Re: How to modify ENUM datatypes?
Previous Message Andrew Sullivan 2008-04-24 16:22:14 Re: How to modify ENUM datatypes?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-04-24 16:28:16 Re: Proposed patch - psql wraps at window width
Previous Message Decibel! 2008-04-24 16:24:29 Re: Index AM change proposals, redux