Re: two-column primary key (not the typical question)

From: Chris Travers <chris(dot)travers(at)gmail(dot)com>
To: Chip Nowacek <chip(at)twostewards(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: two-column primary key (not the typical question)
Date: 2012-07-07 02:09:13
Message-ID: CAKt_ZfvB8jx+MgmqZWSHM8k17DjZWKrp+UHOEOGC+FDxUieM2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 6, 2012 at 7:00 PM, Chip Nowacek <chip(at)twostewards(dot)com> wrote:

> I need a suggestion. I need a two-column primary key that does not depend
> on the order of the entries. That is, for the purposes of the key:
>
> PKColA PKColB
> foo bar
> bar foo
>

What about a unique functional index which would return some sort of
ordered representation of this along with NOT NULL constraints?

I don't know if you can do it as a simple primary key, but you can probably
get unique functional indexes to do the main work for you.

Best Wishes,
Chris Travers

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gurjeet Singh 2012-07-07 02:17:34 Re: two-column primary key (not the typical question)
Previous Message Chip Nowacek 2012-07-07 02:00:01 two-column primary key (not the typical question)