Re: ALTERING A TABLE - Mailing list pgsql-general

From Ron Peterson
Subject Re: ALTERING A TABLE
Date
Msg-id 3936B010.8C86DC3D@yellowbank.com
Whole thread Raw
In response to ALTERING A TABLE  (Peter Landis <ntwebdeveloper@yahoo.com>)
List pgsql-general
Steve Wampler wrote:
>
> Ron Peterson wrote:
> >
> >
> > You can't use ALTER TABLE to change a field's data description.  You'll
> > have to make a new table.  Then use SELECT INTO to move your data.  Then
> > DROP TABLE oldtable.  Then ALTER TABLE tablename RENAME TO newname.
>
> Would this really work?  According to the docs, SELECT INTO creates a
> new table (which must not yet exist).  So this new table
> would have the same field data descriptions as the original, right?
>
> Is the documentation wrong?

Umm, no - I'm stupid.  Perhaps use COPY instead.  E.G. - COPY tablename
TO '/var/temp.data';  COPY newtable FROM '/var/temp.data';

Sorry.  I'll remember to try it myself first nextime.

-Ron-

pgsql-general by date:

Previous
From: Brad Drew
Date:
Subject: Database and snort together
Next
From: "Howard"
Date:
Subject: Any limit on data type,...?