Re: [GENERAL] How to create primary key

2007-11-06 Thread Samantha Atkins
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

Re: [GENERAL] How to create primary key

2007-11-06 Thread Raymond O'Donnell
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); http://www.postgresql.org/docs/8.2/static/sql-altertable.html

[GENERAL] How to create primary key

2007-11-06 Thread Reg Me Please
Hi all. What'd be the syntax to create a primary key on an already build table? Thanks. -- Reg me Please ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] How to create primary key

2007-11-06 Thread Magnus Hagander
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

Re: [GENERAL] How to create primary key

2007-11-06 Thread Richard Huxton
Reg Me Please wrote: Hi all. What'd be the syntax to create a primary key on an already build table? Hmm - so you want to sort of alter a table and add a primary key constraint to an existing column? ALTER TABLE my_table ADD PRIMARY CONSTRAINT (existing_column); All in the manuals:

Re: [GENERAL] How to create primary key

2007-11-06 Thread Raymond O'Donnell
On 06/11/2007 09:38, Samantha Atkins wrote: 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? confession To make sure I got it right, I tried it out using PgAdmin and copied the

Re: [GENERAL] How to create primary key

2007-11-06 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/06/07 03:15, Richard Huxton wrote: Reg Me Please wrote: Hi all. What'd be the syntax to create a primary key on an already build table? Hmm - so you want to sort of alter a table and add a primary key constraint to an existing column?

Re: [GENERAL] How to create primary key

2007-11-06 Thread Albe Laurenz
Reg Me Please wrote: What'd be the syntax to create a primary key on an already build table? As described in the documentation: ALTER TABLE name ADD [CONSTRAINT constraint name] PRIMARY KEY (colname [, ...]) [WITH (FILLFACTOR = number)] [USING INDEX TABLESPACE tbsp name] Yours, Laurenz Albe

Re: [GENERAL] How to create primary key

2007-11-06 Thread Richard Huxton
Albe Laurenz wrote: Richard Huxton wrote: What'd be the syntax to create a primary key on an already build table? ALTER TABLE my_table ADD PRIMARY CONSTRAINT (existing_column); I'm sure it's just a typo, but that is wrong. It is not ADD PRIMARY CONSTRAINT, but ADD PRIMARY KEY. It is indeed

Re: [GENERAL] How to create primary key

2007-11-06 Thread Albe Laurenz
Richard Huxton wrote: What'd be the syntax to create a primary key on an already build table? ALTER TABLE my_table ADD PRIMARY CONSTRAINT (existing_column); I'm sure it's just a typo, but that is wrong. It is not ADD PRIMARY CONSTRAINT, but ADD PRIMARY KEY. Yours, Laurenz Albe