Re: delete column - Mailing list pgsql-general

From Mathieu Arnold
Subject Re: delete column
Date
Msg-id 4126034.1019933543@tot.in.t-online.fr
Whole thread Raw
In response to Re: delete column  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general

--On samedi 27 avril 2002 11:08 -0400 Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Bruce Momjian <pgman@candle.pha.pa.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;
ALTER TABLE new RENAME TO old;

is the better.

--
Mathieu Arnold

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: requesting features in PostgreSQL
Next
From: Jeff Davis
Date:
Subject: Re: requesting features in PostgreSQL