Re: [GENERAL] Re: More PostgreSQL stuff

From: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: Martin Schulze <joey(at)infodrom(dot)north(dot)de>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Re: More PostgreSQL stuff
Date: 1998-10-04 18:23:51
Message-ID: Pine.BSF.4.02.9810041420310.17324-100000@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2 Oct 1998, Oliver Elphick wrote:

> > . I wonder how one could add or remove columns from existing tables.
> >
> > With mSQL this was possible with a trick. You had to dump the
> > whole table but you could tell the dump program to add dummy fields
> > or to leave out existing fields. Is there any such possibility
> > with PostgreSQL?

chk out the 'ALTER TABLE' man page...you can add columns quite
easily using this. removing coloumsn is a little more tricky at this
point in time, but we're hoping to add it to the ALTER TABLE syntax 'in
the future'.

Basically, to drop a column, do an 'INSERT INTO...SELECT FROM' (my
syntax may be slightly off, please check man pages) from the table you
want to remove the column from, such that you only insert the columns you
want to remain. Then, when finished, do a ... damn, haven't used this one
yet, so don't remember what the 'command' is...but there is one to do a
RENAME of a table...rename the old to something different, and rename the
new to the old...

Marc G. Fournier scrappy(at)hub(dot)org
Systems Administrator @ hub.org
scrappy(at){postgresql|isc}.org ICQ#7615664

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 1998-10-04 18:46:09 Re: [GENERAL] Re: More PostgreSQL stuff
Previous Message Marc G. Fournier 1998-10-04 18:20:18 Re: [GENERAL] Re: More PostgreSQL stuff