From: Richard Broersma Jr <rabroersma@yahoo.com>
To: Carol Walter <walterc@indiana.edu>
To: pgsql-admin@postgresql.org
Subject: Re: Primary key
Date: Wed, 19 Sep 2007 08:26:15 -0700 (PDT)
Message-ID: <558465.79884.qm@web31808.mail.mud.yahoo.com> (raw)
In-Reply-To: <94AE7849-041D-44EC-BF46-E8D13990CEE9@indiana.edu>
--- Carol Walter <walterc@indiana.edu> wrote:
> Does postgres allow compound or composite keys for primary keys? I
> thought I read someplace that it didn't. Now, I can't find a
> reference to it.
It does. composite key are defined as a table constraint:
http://www.postgresql.org/docs/8.2/interactive/sql-createtable.html
This link illistrates syntax with this example:
CREATE TABLE films (
code char(5),
title varchar(40),
did integer,
date_prod date,
kind varchar(10),
len interval hour to minute,
CONSTRAINT code_title PRIMARY KEY(code,title)
);
Regards,
Richard Broersma Jr.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: rabroersma@yahoo.com, walterc@indiana.edu
Subject: Re: Primary key
In-Reply-To: <558465.79884.qm@web31808.mail.mud.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox