pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Brannen <kevinb@nurseamerica.net>
To: pgsql-admin@postgresql.org
Subject: alter table modify column?
Date: Wed, 10 Jul 2002 18:16:52 -0500
Message-ID: <3D2CC064.7010108@nurseamerica.net> (raw)

As we transition our database, I'm finding the need to change columns 
types.  I'm also finding this to be a major PITA.

I have a column that's a something like:

create table stuff
(
...
rate   varchar(7),
...
);

However that doesn't allow math-like functions (e.g. avg), so it's gotta 
be changed.  I'd like to do something on the order of:

alter table stuff modify rate DECIMAL(5,2);

but that doesn't work.  I've scoured the docs and can't seem to find 
anything other than:

1. create new table with changed columns,
2. copy data over,
3. remove old table,
4. rename new table to old table

Please tell me there's an easier way!  And of course how. :-)

Also, I can't find a "alter table drop column NAME" to remove a column 
either.

TIA,
Kevin




view thread (2+ messages)  latest in thread

Message-ID: <3D2CC064.7010108@nurseamerica.net>
Permalink:  ../3D2CC064.7010108@nurseamerica.net/
Also on:    postgresql.org/message-id/3D2CC064.7010108@nurseamerica.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: kevinb@nurseamerica.net
  Subject: Re: alter table modify column?
  In-Reply-To: <3D2CC064.7010108@nurseamerica.net>
  References: <3D2CC064.7010108@nurseamerica.net>

* 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