Re: How to create primary key - Mailing list pgsql-general

From Magnus Hagander
Subject Re: How to create primary key
Date
Msg-id 20071106095700.GC32607@svr2.hagander.net
Whole thread Raw
In response to Re: How to create primary key  (Samantha Atkins <sjatkins@mac.com>)
List pgsql-general
On Tue, Nov 06, 2007 at 01:38:31AM -0800, Samantha Atkins wrote:
>
> On Nov 6, 2007, at 1:15 AM, Raymond O'Donnell wrote:
>
> >On 06/11/2007 08:54, Reg Me Please wrote:
> >
> >>What'd be the syntax to create a primary key on an already build
> >>table?
> >
> >ALTER TABLE test ADD CONSTRAINT test_pk PRIMARY KEY (f1);
> >
>
> So, ALTER TABLE test ADD PRMARY KEY(f1 [, ... ] )
> isn't enough?  It appears in the examples.  What more does the
> explicit test_pk do that wouldn't happen anyway?

It's not needed. It gives a name to the primary key. If you don't specify
one, the system will pick one for you automatically.

//Magnus

pgsql-general by date:

Previous
From: Samantha Atkins
Date:
Subject: Re: How to create primary key
Next
From: Raymond O'Donnell
Date:
Subject: Re: How to create primary key