Unexpected ALTER TABLE behavior

From: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
To: pggeneral <pgsql-general(at)postgreSQL(dot)org>
Subject: Unexpected ALTER TABLE behavior
Date: 2001-07-18 22:56:10
Message-ID: 3B56140A.80AD7814@austin.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Ed Loehr 2001-07-18 23:01:12 Re: undeleteable records
Previous Message Lamar Owen 2001-07-18 22:44:07 PostgreSQL 7.1.2-5PGDG RPMset released for Red Hat 7.1.