Skip site navigation (1) Skip section navigation (2)

Re: delete column

From: Mathieu Arnold <mat(at)mat(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>,"Hillensbeck, Preston" <PHillensbeck(at)sfbcic(dot)com>,'webmaster' <webmaster(at)harbornet(dot)com>,"'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: delete column
Date: 2002-04-27 16:52:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general

--On samedi 27 avril 2002 11:08 -0400 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>>> Oops my mistake!  I actually didn't use select into to create the
>>> table,  because I didn't want the columns exactly the same as before -
>>> was  switching from varchar to text.
>> Oh, yes, that makes sense for your case. You can't control the data
>> types with SELECT INTO.
> You could with an explicit cast:
> 	SELECT varcharcol::text INTO newtable FROM ...

I really think that :
CREATE new (all without the one(s) we don't want and their defaults)
INSERT INTO new select ... from old;
DROP old;

is the better.

Mathieu Arnold

In response to

pgsql-general by date

Next:From: Jeff DavisDate: 2002-04-27 18:42:04
Subject: Re: requesting features in PostgreSQL
Previous:From: Tom LaneDate: 2002-04-27 15:39:17
Subject: Re: requesting features in PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group