Thread: drop column

drop column

From
Peter Pilsl
Date:
is there a trick to drop a column in a table ? or do I need to
recreate the table and drop the old one ?

thnx,
peter

--
mag. peter pilsl

phone: +43 676 3574035
fax  : +43 676 3546512
email: pilsl@goldfisch.at
sms  : pilsl@max.mail.at

pgp-key available

Re: drop column

From
Keary Suska
Date:
Unfortunately, Postgres' greatest shortcoming (IMHO) is the inability to
change table definitions much after creation. To effect any column changes
besides DEFAULT clauses and indexing (and a few other options), you have to
drop and re-create the table.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

> From: Peter Pilsl <pilsl@goldfisch.at>
> Date: Thu, 18 Oct 2001 10:44:34 +0200
> To: postgres mailinglist <pgsql-general@postgresql.org>
> Subject: [GENERAL] drop column
>
> is there a trick to drop a column in a table ? or do I need to
> recreate the table and drop the old one ?
>
> thnx,
> peter
>
> --
> mag. peter pilsl
>
> phone: +43 676 3574035
> fax  : +43 676 3546512
> email: pilsl@goldfisch.at
> sms  : pilsl@max.mail.at
>
> pgp-key available
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


Re: drop column

From
Russ McBride
Date:
Amen.


>Unfortunately, Postgres' greatest shortcoming (IMHO) is the inability to
>change table definitions much after creation. To effect any column changes
>besides DEFAULT clauses and indexing (and a few other options), you have to
>drop and re-create the table.
>
>Keary Suska
>Esoteritech, Inc.
>"Leveraging Open Source for a better Internet"
>
> > From: Peter Pilsl <pilsl@goldfisch.at>
> > Date: Thu, 18 Oct 2001 10:44:34 +0200
> > To: postgres mailinglist <pgsql-general@postgresql.org>
> > Subject: [GENERAL] drop column
> >
> > is there a trick to drop a column in a table ? or do I need to
> > recreate the table and drop the old one ?
> >
> > thnx,
> > peter
> >
> > --
> > mag. peter pilsl
> >
> > phone: +43 676 3574035
> > fax  : +43 676 3546512
> > email: pilsl@goldfisch.at
> > sms  : pilsl@max.mail.at
> >
> > pgp-key available
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo@postgresql.org so that your
> > message can get through to the mailing list cleanly
> >
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html


Re: drop column

From
Martijn van Oosterhout
Date:
On Thu, Oct 18, 2001 at 12:03:35PM -0600, Keary Suska wrote:
> Unfortunately, Postgres' greatest shortcoming (IMHO) is the inability to
> change table definitions much after creation. To effect any column changes
> besides DEFAULT clauses and indexing (and a few other options), you have to
> drop and re-create the table.

Well, you can add and rename columns. What I tend to do is rename them to
unused_xx and then if I ever get around to reloading the database, I simply
exclude them.

But yeah, it would be nice. Anyone volunteering?

I think there are some discussions about this and basically it would require
allowing different rows in the same table to have different numbers of
fields. Adding to the end is easy because you can just fill in the nulls on
load.

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.