Re: [HACKERS] Foreign keys: unexpected result from ALTER TABLE... ADD CONSTRAINT...

From: Peter Eisentraut <e99re41(at)DoCS(dot)UU(dot)SE>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Foreign keys: unexpected result from ALTER TABLE... ADD CONSTRAINT...
Date: 2000-01-17 13:05:51
Message-ID: Pine.GSO.4.02A.10001171401260.8593-100000@Puma.DoCS.UU.SE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 17 Jan 2000, Oliver Elphick wrote:

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

I don't think this will ever work. I can't really decode your intentions
here but I recall that translating proper relational schemas (you know,
the ones with the bubbles and lines) into tables never creates this sort
of situation. Then again I could be wrong.

>
> 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?

Thanks for that fix, that was me changing the grammar for an ALTER TABLE /
ALTER COLUMN implementation, which now works btw.

--
Peter Eisentraut Sernanders vaeg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hakan Tandogan 2000-01-17 13:45:42 Auto-lowercasing of column names?
Previous Message Oliver Elphick 2000-01-17 12:43:44 Foreign keys: unexpected result from ALTER TABLE... ADD CONSTRAINT...