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


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to