Bug in ADD COLUMN with REFERENCES

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug in ADD COLUMN with REFERENCES
Date: 2001-07-26 04:45:26
Message-ID: ECEHIKNFIMMECLEBJFIGEEFNCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Try this:

test=# create table parent(a int4 primary key);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'parent_pkey'
for table 'parent'
CREATE
test=# alter table parent add column "b" int4 references parent(c) on delete
set null;
ALTER
test=# \d test
Did not find any relation named "test".
test=# \d parent
Table "parent"
Attribute | Type | Modifier
-----------+---------+----------
a | integer | not null
b | integer |
Index: parent_pkey

Notice how the reference to the non-existent column was allowed...

Now I check the pg_trigger table:

test=# select * from pg_trigger;
tgrelid | tgname | tgfoid | tgtype | tgenabled | tgisconstraint |
tgconst
rname | tgconstrrelid | tgdeferrable | tginitdeferred | tgnargs | tgattr |
tgargs
---------+----------------+--------+--------+-----------+----------------+--
------
------+---------------+--------------+----------------+---------+--------+--
------
1260 | pg_sync_pg_pwd | 1689 | 29 | t | f |
| 0 | f | f | 0 | |
(1 row)

...and it looks like the reference was never created...

Chris

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-07-26 04:45:50 Re: Slow Performance in PostgreSQL
Previous Message Steve Howe 2001-07-26 04:24:42 LIBPQ on Windows and large Queries