Foreign keys: unexpected result from ALTER TABLE... ADD CONSTRAINT...

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Foreign keys: unexpected result from ALTER TABLE... ADD CONSTRAINT...
Date: 2000-01-17 12:43:44
Message-ID: 200001171243.MAA12727@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I cannot do this pair of table creations directly, because they are mutually
dependent.

create table purchased_job
(
supplier char(10) not null
references supplier (id) match full,
specification text,
del_point char(2) not null
references location (id) match full,
import_licence bool default 'f',
import_duty numeric(12,2),
terms char(3),
deliv_clear numeric(12,2),

foreign key (product, supplier) references product_supplier (product,
supplier) match full
)
inherits (job)
;

create table product_supplier
(
product char(10) not null
references purchased_job (product) match full,
supplier char(10) not null
references supplier (id) match full,

primary key (product, supplier)
)
;

so I omitted the foreign key specification from the creation of purchased_job
and tried to add it afterwards, but (after fixing a bug in gram.y) I found
that ALTER TABLE ... ADD CONSTRAINT is not yet implemented. Is there, then, any
way to create this mutual dependency?

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"And, behold, I come quickly; and my reward is with me,
to give every man according as his work shall be."
Revelation 22:12

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-01-17 13:05:51 Re: [HACKERS] Foreign keys: unexpected result from ALTER TABLE... ADD CONSTRAINT...
Previous Message Peter Eisentraut 2000-01-17 11:13:35 Re: [HACKERS] TODO list