pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jie Liang <jliang@ipinc.com>
To: Webb Sprague <wsprague100@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Create Primary Key?
Date: Tue, 29 Aug 2000 18:50:53 -0700
Message-ID: <39AC687D.D38ACA3D@ipinc.com> (raw)
References: <20000830003714.22218.qmail@web803.mail.yahoo.com>

Hi,

It suppose to use ALTER TABLE tablename ADD constraint xxx primary
key(columnname),
unforturatly, Pg7.0 still haven't implemented it yet, so except foreign
key ,other constarints,
you have to choose:
1. rename your old table, recreate an new one with primary key, then use

insert into newtable select * from oldtable.
2. use pg_dump -t tablename -f scriptfile dbname
in shell , edit that scriptfile, add primary key there,
drop your table, then reload it again:
psql dbname<scriptfile

Webb Sprague wrote:

> Apropos of my last question:
>
> Is there syntax to create a primary key after the
> table has been defined and populated?  I think I could
> speed things up quite a bit by not having any indexes
> at all when I do my mass copies.
>
> Thanks, and my apologies if that is a totally stupid
> question.
>
> W
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com






view thread (5+ messages)  latest in thread

Message-ID: <39AC687D.D38ACA3D@ipinc.com>
Permalink:  ../39AC687D.D38ACA3D@ipinc.com/
Also on:    postgresql.org/message-id/39AC687D.D38ACA3D@ipinc.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jliang@ipinc.com, wsprague100@yahoo.com
  Subject: Re: Create Primary Key?
  In-Reply-To: <39AC687D.D38ACA3D@ipinc.com>
  References: <20000830003714.22218.qmail@web803.mail.yahoo.com> <39AC687D.D38ACA3D@ipinc.com>

* 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