Re: Foreign key problem

From: x <x_at_not-exists.org>
Date: Thu, 15 Jun 2006 10:41:35 +0300
Message-ID: <e6r2oc$7m8$1_at_nntp.aioe.org>


"Jay Dee" <ais01479_at_aeneas.net> wrote in message news:mn0kg.59063$mh.32302_at_tornado.ohiordc.rr.com...
> I didn't pay much attention to this until the thread got
> surprisingly long.

> frebe73_at_gmail.com wrote:
> > I am working on an application which need a data model that reflects
> > the schema structure. My tables are ("*" indicates primary key column):
>
> The schema-before-model bit confuses me; are you really stuck in
> this circumstance?.
>
> > tableinfo(*table_name)
> > columninfo(*table_name, *col_name)
> > fk(*fk_name, pk_table, fk_table)
> > fk_column(*fk_name, *fk_column, pk_column)
>
> All one really needs - using your notation - is
>
> tables (*table_name)
> columns (*table_name, *col_name)
> foreign_keys (*fk_table_name, *fk_column,
> *pk_table_name, *pk_column)

tables(t1).
tables(t2).

columns(t1,c1).
columns(t1,c2).
columns(t1,c3).
columns(t1,c4).

columns(t2,c5).

columns(t2,c6).
columns(t2,c7).
foreign_keys(t1,c1,t2,c5).
foreign_keys(t1,c2,t2,c6).
foreign_keys(t1,c3,t2,c7).


foreign_keys(t1,c2,t2,c6).

foreign_keys(t1,c3,t2,c7).
foreign_keys(t1,c4,t2,c5).
t1(1,2,3,4).
t2(1,2,3).
t2(4,2,3).
Received on Thu Jun 15 2006 - 09:41:35 CEST

Original text of this message