Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

Next:From: Janet CullenDate: 2004-02-04 17:48:44
Subject: Dual Primary Keys
Previous:From: Tom LaneDate: 2004-02-04 16:22:06
Subject: Re: Dual Primary keys

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group