Unexpected ALTER TABLE behavior - Mailing list pgsql-general

From Ed Loehr
Subject Unexpected ALTER TABLE behavior
Date
Msg-id 3B56140A.80AD7814@austin.rr.com
Whole thread Raw
List pgsql-general
This looks like a silent partial failure case in 7.1.2.  Maybe someone
can confirm or explain?  I would expect the following to succeed
completely or generate an error message with no side-effects.  Instead,
it appears to add the column but without the "not null" constraint.

    create table mytable (id integer);
    alter table mytable add column name varchar not null;

Here's what I saw:

% psql -V
psql (PostgreSQL) 7.1.2
...
% createdb testdb
CREATE DATABASE
% psql -d testdb -c "create table mytable (id integer);"
CREATE
% psql -d testdb -c "alter table mytable add column name varchar not
null;"
ALTER
% psql -d testdb -c "\d mytable"
             Table "mytable"
 Attribute |       Type        | Modifier
-----------+-------------------+----------
 id        | integer           |
 name      | character varying |


Regards,
Ed Loehr

pgsql-general by date:

Previous
From: Ed Loehr
Date:
Subject: Re: undeleteable records
Next
From: Adam Manock
Date:
Subject: Re: replication?