Re: Composite types for composite primary/foreign keys? - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: Composite types for composite primary/foreign keys?
Date
Msg-id E84A9C32-3E84-4AF0-9E7C-390FB6627566@seespotcode.net
Whole thread Raw
In response to Composite types for composite primary/foreign keys?  (Wolfgang Keller <wolfgang.keller.privat@gmx.de>)
Responses Re: Composite types for composite primary/foreign keys?  (Wolfgang Keller <wolfgang.keller.privat@gmx.de>)
List pgsql-general
On Nov 16, 2007, at 4:07 , Wolfgang Keller wrote:

> But I am pathetically lazy >;->, so I ld like to save keystrokes
> and thus I had the (maybe pathetic)idea to use composite types for
> the composite primary (and foreign) keys. No luck again, it seems
> to me, as according to the documentation: "since no constraints are
> associated with a composite type, the constraints shown in the
> table definition do not apply to values of the composite type
> outside the table".

Note: "do not apply to values of the composite type outside of the
table". Both primary keys and foreign keys are defined within tables,
so AIUI this statement does not preclude you from using composite
types as primary and foreign keys.

> I'm sorry, but I'm apparently too dump to actually figure out
> myself whether this means that I can use a single composite type
> column as a primary / foreign key or whether not...?

What have you actually tried? You can learn a lot by a few minutes of
exploration at a psql prompt.

Michael Glaesemann
grzm seespotcode net



pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: "and then" / "or else"
Next
From: Christian Schröder
Date:
Subject: Re: "and then" / "or else"