Re: Dual Primary keys

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Bantamess" <bantamess(at)yahoo(dot)co(dot)uk>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Dual Primary keys
Date: 2004-02-04 17:31:46
Message-ID: 200402040931.46200.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Janet,

> I also tried this:
> create table borrower(user_id int ,
> issn varchar(15),
> primary key user_id, issn);
> ERROR: parser: parse error at or near "user_id" at character 68

This is, I think, what you want. However, you have a syntax error in your
primary key constraint declaration:

CONSTRAINT borrower_pk PRIMARY KEY (user_id, issn)

Also, both user_id and issn should be declared NOT NULL.

Overally, I suggest picking up an "introduction to SQL book", such as "SQL
Queries for Mere Mortals."

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Janet Cullen 2004-02-04 17:48:44 Dual Primary Keys
Previous Message Tom Lane 2004-02-04 16:22:06 Re: Dual Primary keys