Re: An easy question about creating a primary key

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Ligia Pimentel" <lmpimentel(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: An easy question about creating a primary key
Date: 2001-12-04 02:12:21
Message-ID: 20774.1007431941@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-odbc pgsql-sql

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> I have submitted code for 7.2b3 that allows ADD UNIQUE after table creation,
> but you'll have to wait until 7.3 for ADD PRIMARY KEY after table createion.

I think you've forgotten your own work, Chris.

regression=# create table foo (bar int not null);
CREATE
regression=# alter table foo add primary key (bar);
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index 'foo_pkey' for table 'foo'
CREATE
regression=#

Having to have marked the columns as "not null" from the beginning is a
painful limitation, but it's not like the feature doesn't exist at all.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Manuel Cabido 2001-12-04 02:18:45 Re: date formatting and tab-complete patch
Previous Message Christopher Kings-Lynne 2001-12-04 01:36:18 Re: An easy question about creating a primary key

Browse pgsql-odbc by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-12-04 02:23:19 Re: [SQL] An easy question about creating a primary key
Previous Message Christopher Kings-Lynne 2001-12-04 01:36:18 Re: An easy question about creating a primary key

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-12-04 02:23:19 Re: [SQL] An easy question about creating a primary key
Previous Message Christopher Kings-Lynne 2001-12-04 01:36:18 Re: An easy question about creating a primary key