pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Grigoriy G. Vovk <grigoriy.vovk@linustech.com.cy>
To: Robby Slaughter <webmaster@robbyslaughter.com>
Cc: Suhadi <suhadi@indosatcom.net>
Cc: SQL <pgsql-sql@postgresql.org>
Subject: RE: Delete coloumn
Date: Tue, 7 Aug 2001 11:13:55 +0300 (EEST)
Message-ID: <20010807110112.R931-100000@callisto.internal.linustech.com.cy> (raw)
In-Reply-To: <EPEHLKLEHAHLONFOKNHNEEOODDAA.webmaster@robbyslaughter.com>

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




view thread (5+ messages)

Message-ID: <20010807110112.R931-100000@callisto.internal.linustech.com.cy>
Permalink:  ../20010807110112.R931-100000@callisto.internal.linustech.com.cy/
Also on:    postgresql.org/message-id/20010807110112.R931-100000@callisto.internal.linustech.com.cy

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: grigoriy.vovk@linustech.com.cy, webmaster@robbyslaughter.com, suhadi@indosatcom.net
  Subject: RE: Delete coloumn
  In-Reply-To: <20010807110112.R931-100000@callisto.internal.linustech.com.cy>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox