Re: Nu-B\Column:Alter type - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Nu-B\Column:Alter type
Date
Msg-id web-700839@davinci.ethosmedia.com
Whole thread Raw
In response to Re: Nu-B\Column:Alter type  (john-paul delaney <jp@justatest.com>)
Responses Re: Nu-B\Column:Alter type
List pgsql-novice
> In your sequence below - where does the column (e.g. col 8 of 25) get
>  changed?

Ooops.
Step 0.1:  pg_dump -s -t bad_table > bad_table.sql
Step 0.2:  Edit bad_table.sql to the table definition you want.
Step 0.3: Use the file bad_table.sql as your CREATE TABLE statement in
 step 3.

> Would I list the good column names to insert into bad_table in point
>  4., then insert my new column - or is there a way to "select *
>  except one" (I guess that's pretty lax SQL)?

Hmmm ... I thought that you wanted to change an existing column from
 DATE to VARCHAR.

> > 1. CREATE TABLE temp1 AS
> >  SELECT * FROM bad_table;
> > 2. DROP TABLE bad_table;
> > 3. CREATE TABLE bad_table;
> > 4. INSERT INTO bad_table SELECT * FROM temp1;
> > 5. DROP TABLE temp1

-Josh


______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

pgsql-novice by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: Nu-B\psql:Command Recall,Repeat?
Next
From: john-paul delaney
Date:
Subject: Re: Nu-B\Column:Alter type