Re: Composite types for composite primary/foreign keys?

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Wolfgang Keller <wolfgang(dot)keller(dot)privat(at)gmx(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Composite types for composite primary/foreign keys?
Date: 2007-11-17 13:24:51
Message-ID: E84A9C32-3E84-4AF0-9E7C-390FB6627566@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christian Schröder 2007-11-17 14:41:23 Re: "and then" / "or else"
Previous Message Michael Glaesemann 2007-11-17 13:20:16 Re: "and then" / "or else"