pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Haddon <tom@betterhealthfoundation.org>
To: pgsql-sql@postgresql.org
Subject: Add Primary Key to a Table
Date: Fri, 2 Aug 2002 16:16:36 -0700
Message-ID: <NEBBIHDGCLBEJMPFAMLACELLCHAA.tom@betterhealthfoundation.org> (raw)

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
_______________________________




view thread (3+ messages)  latest in thread

Message-ID: <NEBBIHDGCLBEJMPFAMLACELLCHAA.tom@betterhealthfoundation.org>
Permalink:  ../NEBBIHDGCLBEJMPFAMLACELLCHAA.tom@betterhealthfoundation.org/
Also on:    postgresql.org/message-id/NEBBIHDGCLBEJMPFAMLACELLCHAA.tom@betterhealthfoundation.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tom@betterhealthfoundation.org
  Subject: Re: Add Primary Key to a Table
  In-Reply-To: <NEBBIHDGCLBEJMPFAMLACELLCHAA.tom@betterhealthfoundation.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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