Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group