Skip site navigation (1) Skip section navigation (2)

Re: Nu-B\Column:Alter type

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: john-paul delaney <jp(at)justatest(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Nu-B\Column:Alter type
Date: 2002-02-22 18:37:37
Message-ID: web-700839@davinci.ethosmedia.com (view raw or flat)
Thread:
Lists: 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(at)agliodbs(dot)com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

In response to

Responses

pgsql-novice by date

Next:From: Josh BerkusDate: 2002-02-22 19:33:58
Subject: Re: One big table or several smaller tables ?
Previous:From: john-paul delaneyDate: 2002-02-22 18:17:26
Subject: Nu-B\Column:Alter type

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group