RE: Delete coloumn - Mailing list pgsql-sql

From Grigoriy G. Vovk
Subject RE: Delete coloumn
Date
Msg-id 20010807110112.R931-100000@callisto.internal.linustech.com.cy
Whole thread Raw
In response to RE: Delete coloumn  ("Robby Slaughter" <webmaster@robbyslaughter.com>)
List pgsql-sql
Aug 6, 23:35 -0500, Robby Slaughter wrote:

> SELECT INTO it. Example:
>
> CREATE TABLE sample (
>   id   INTEGER,
>   data TEXT,
>   badcolumn DATE );
>
> Now to delete the bad column table:
>
> CREATE TABLE sample_copy (
>   id  INTEGER,
>   data TEXT);
>
> and then copy it all over:
>
> SELECT id,data INTO sample_copy FROM sample;

It is not correct. This statement used to _create_ _new_ table.
Correct is:
insert into sample_copy select id, data from sample;

>
> and then you can DROP TABLE sample;
>
> If you need the original table name, repeat the process of
> creating a new table now and copying the data over.
>
> Hope that helps!
>
> -Robby Slaughter

my best regards,
----------------
Grigoriy G. Vovk



pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Delete Trigger Issue
Next
From: Denis Bucher
Date:
Subject: Are circular REFERENCES possible ?