From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: GNATColl ORM problem (foreign key twins) Date: Wed, 30 Oct 2013 18:48:03 +0100 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: <871u32abvw.fsf@adaheads.sparre-andersen.dk> References: <87zjprp1cz.fsf@adaheads.sparre-andersen.dk> NNTP-Posting-Host: 109.59.54.76.mobile.3.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: loke.gir.dk 1383157045 1971 109.59.54.76 (30 Oct 2013 18:17:25 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 30 Oct 2013 18:17:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:ODBjG7hXp+cJoLtZk885MpoCShU= X-Original-Bytes: 2214 Xref: number.nntp.dca.giganews.com comp.lang.ada:183757 Date: 2013-10-30T18:48:03+01:00 List-Id: Simon Wright wrote: > I think that the problem is that the thing in brackets is not meant to > be the PK in the table that is being referenced, it's the name of the > reverse relationship. Look for 'revert_name' under [1] (I'm pretty > sure this should be 'reverse_name', BTW). Thanks. It looks like you are correct. > | TABLE | category_subsets | category_subset | | Item categorisations | > | superset | FK categories(parents) | NOT NULL | | | > | subset | FK categories(children) | NOT NULL | | | It can be even simpler: | TABLE | category_subsets | category_subset | | Item categorisations | | superset | FK categories | NOT NULL | | | | subset | FK categories | NOT NULL | | | > [1] http://docs.adacore.com/gnatcoll-docs/sql.html#database-schema The formal grammar for foreign keys might be improved by making it explicit that the reverse_name isn't required. Once more; thanks for clarifying the documentation for me. Greetings, Jacob -- "... while the C compiler will happily generate code for almost anything produced by leaning on the keyboard."