alter table

Started by Diego Cattelanabout 23 years ago2 messagesbugs
Jump to latest
#1Diego Cattelan
netmaniac@libero.it

template1=#create database gesart;
template1=#create user xuser;
template1=# \c gesart xuser

gesart=>create table a(n integer);

CREATE TABLE
gesart=>alter table a add column c integer references xxxxxxx(id);

NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ALTER TABLE

The table xxxxxxx doesn't exist.

Is that correct or postgreSQL should report an error ?

PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2
20020903 (Red Hat Linux 8.0 3.2-7)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Diego Cattelan (#1)
Re: alter table

"Diego Cattelan" <netmaniac@libero.it> writes:

gesart=3D>alter table a add column c integer references xxxxxxx(id);
=20
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ALTER TABLE
=20
The table xxxxxxx doesn't exist.
=20
Is that correct or postgreSQL should report an error ?

It is an error. 7.3.* has a bug with ALTER TABLE ADD COLUMN: any
foreign-key reference clauses are ignored. This is fixed for 7.3.3.

regards, tom lane