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: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

> 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-2017 The PostgreSQL Global Development Group