[BioSQL-l] Tables without a (composite) primary key

Peter biopython at maubp.freeserve.co.uk
Thu Nov 6 22:12:28 UTC 2008


On Thu, Nov 6, 2008 at 9:39 PM, Hilmar Lapp <hlapp at gmx.net> wrote:
>
> Hi Peter,
>
> it's a known enhancement request. I know that some ORMs have trouble reverse
> engineering the mapping if there is no PK defined.

Oh right, "Surrogate primary keys on all tables" on this page:
http://www.biosql.org/wiki/Enhancement_Requests

> Semantically, however, in the absence of a primary key constraint the first
> unique key constraint is equivalent to a primary key (in fact some ER
> modeling tools will automatically do the conversion); unique keys are also
> called alternate keys (alternate to the primary key).
>
> So for now feel free to either change the UK constraint to PK where there is
> no PK defined and your reverse engineering tool needs it. If you don't use a
> reverse engineering tool, just set the columns of the UK constraint as the
> compound primary key if there isn't a surrogate PK.

OK - I'll bear that in mind.

> BioSQL 1.1+ will have surrogate PKs on all tables, but this change may not
> be backwards compatible for existing language bindings, which is why I'd
> like to make those changes first that should be fully backwards compatible.

That sounds sensible.

Thanks Hilmar!

Peter

P.S. Is there any agreed terminology: compound primary key versus
composite primary key?



More information about the BioSQL-l mailing list