Re: how to set more than two attributes as primary keys in a table

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Casey Allen Shobe <cshobe(at)softhome(dot)net>
Cc: Peggy Go <shatz_go(at)yahoo(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: how to set more than two attributes as primary keys in a table
Date: 2003-12-29 17:21:28
Message-ID: 20031229172128.GB9888@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Dec 29, 2003 at 12:09:01 -0500,
Casey Allen Shobe <cshobe(at)softhome(dot)net> wrote:
> Bruno Wolff III (Monday 29 December 2003 12:14)
> > Note that isn't quite the same unless you add NOT NULL constraints for
> > foo and bar.
>
> Oops! You're right, and the ID column needs a 'not null' as well. I just
> typed that in a hurry and forgot. Sorry.

A primary key constraint implies both unique and not null, so you don't
need to use NOT NULL on the ID column.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Casey Allen Shobe 2003-12-29 17:43:36 Re: how to set more than two attributes as primary keys in a table
Previous Message Bruno Wolff III 2003-12-29 17:14:27 Re: how to set more than two attributes as primary keys in a table