pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedAdd Primary Key to a Table
3+ messages / 2 participants
[nested] [flat]
* Add Primary Key to a Table
@ 2002-08-02 23:16 Tom Haddon <tom@betterhealthfoundation.org>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Haddon @ 2002-08-02 23:16 UTC (permalink / raw)
To: pgsql-sql
Hi Folks,
I'm trying to use the ALTER TABLE command to add a primary key to a table.
The command I am using is:
ALTER TABLE "agency_contact_info" ADD CONSTRAINT "agency_contact_info_pkey"
PRIMARY KEY ("id");
I get a message saying "ALTER TABLE / ADD CONSTRAINT not implemented for
that constraint type". Is this a bug, or am I doing something wrong?
The reason I am trying to do this is that I want to split a table with a
large number of fields up into a few tables with a sub-set of fields from
the original table, linked by FOREIGN KEY on "id". I had thought the best
way to do this was to use SELECT INTO and then try to alter the tables to
include PRIMARY and FOREIGN keys where applicable. Is there a better way to
do this?
Thanks, Tom
_______________________________
Tom Haddon
IT Director
The Better Health Foundation
414 Thirteenth Street, Suite 450
Oakland, CA 94612
(510) 444-5096
www.betterhealthfoundation.org
_______________________________
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Add Primary Key to a Table
@ 2002-08-02 23:19 Josh Berkus <josh@agliodbs.com>
parent: Tom Haddon <tom@betterhealthfoundation.org>
0 siblings, 1 reply; 3+ messages in thread
From: Josh Berkus @ 2002-08-02 23:19 UTC (permalink / raw)
To: Tom Haddon <tom@betterhealthfoundation.org>; pgsql-sql
Tom,
> ALTER TABLE "agency_contact_info" ADD CONSTRAINT "agency_contact_info_pkey"
> PRIMARY KEY ("id");
>
> I get a message saying "ALTER TABLE / ADD CONSTRAINT not implemented for
> that constraint type". Is this a bug, or am I doing something wrong?
What version are you using? That command is supported with Postgres 7.2, but
not with earlier versions.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Add Primary Key to a Table
@ 2002-08-02 23:20 Tom Haddon <tom@betterhealthfoundation.org>
parent: Josh Berkus <josh@agliodbs.com>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Haddon @ 2002-08-02 23:20 UTC (permalink / raw)
To: josh@agliodbs.com; +Cc: pgsql-sql
Hi Josh,
I think that solves it for me - I'm using 7.1.3 - will upgrade
appropriately.
Thanks, Tom
-----Original Message-----
From: Josh Berkus [mailto:josh@agliodbs.com]
Sent: Friday, August 02, 2002 4:20 PM
To: Tom Haddon; pgsql-sql@postgresql.org
Subject: Re: [SQL] Add Primary Key to a Table
Tom,
> ALTER TABLE "agency_contact_info" ADD CONSTRAINT
"agency_contact_info_pkey"
> PRIMARY KEY ("id");
>
> I get a message saying "ALTER TABLE / ADD CONSTRAINT not implemented for
> that constraint type". Is this a bug, or am I doing something wrong?
What version are you using? That command is supported with Postgres 7.2,
but
not with earlier versions.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-08-02 23:20 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-02 23:16 Add Primary Key to a Table Tom Haddon <tom@betterhealthfoundation.org>
2002-08-02 23:19 ` Josh Berkus <josh@agliodbs.com>
2002-08-02 23:20 ` Tom Haddon <tom@betterhealthfoundation.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox