Re: Bug in 7.2.1? -- ERROR: Adding columns with defaults is not implemented. - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: Bug in 7.2.1? -- ERROR: Adding columns with defaults is not implemented.
Date
Msg-id 20020708130204.H15271@mail.libertyrms.com
Whole thread Raw
In response to Bug in 7.2.1? -- ERROR: Adding columns with defaults is not implemented.  (adwolf1@yahoo.com (ad wolf))
List pgsql-general
On Sat, Jul 06, 2002 at 05:33:29PM -0700, ad wolf wrote:
> Using pg 7.1.2,  I can enter the following statement successfully:
>
> # alter table manufacturer add column dummy integer not null default
> 1;

Yes, it succeeds.  But check the table after you're done: the "not
null" has not taken effect.  In fact, it's not implemented, and it
just fails silently in the 7.1 series.

>
> However, under 7.2.1, the same statement gets me --
>
> ERROR:  Adding columns with defaults is not implemented.
>         Add the column, then use ALTER TABLE SET DEFAULT.
>
> My question is two-fold -- first, is this new behavior a feature, or a
> bug?

A feature to address the previous bug (silent failure of a legal SQL
statement).

> Second, what features/fixes would i lose by reverting to 7.1.2?

There were a number of bugfixes in 7.2.  Also, the planner and
optimiser are much improved, and there is the nice new
statistics-gathering subsystem.

> I'd like to stick with 7.2.1, but this new behavior is making it
> difficult for me.  I can't simply drop & recreate all my tables just
> to add a column!

You can add a constraint to get the NOT NULL feature.

A

--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110




pgsql-general by date:

Previous
From: Jeff Boes
Date:
Subject: Index used under 7.2 slows down query?
Next
From: Doug Fields
Date:
Subject: Re: WAL recycling, Linux 2.4.18