Re: Dual Primary keys - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Dual Primary keys
Date
Msg-id 200402040931.46200.josh@agliodbs.com
Whole thread Raw
In response to Dual Primary keys  ("Bantamess" <bantamess@yahoo.co.uk>)
List 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


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Dual Primary keys
Next
From: "Bantamess"
Date:
Subject: Dual Primary Keys