Alter table alter column using question

From: Craig Servin <cservin(at)cromagnon(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Alter table alter column using question
Date: 2006-04-27 15:40:29
Message-ID: 200604271040.29326.cservin@cromagnon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I have a table called type:

type
-------
type_id integer
tvalue smallint
...
..
..

tvalue was a second key on this table which now turns out to be unnecessary.
Before I can remove it I need to change the columns which reference it. I
wanted to do this with

alter table alter column using

But the using clause I am using does not work. I think I may just be
misunderstanding how this is done, but I could only find a few examples.

Here is an example of what I have tried:

alter table service.service
alter column environment_tvalue type integer
using select type.type.type_id where tvalue = environment_tvalue and
typeset_id = 1;

Does the expression in the using clause have to be a function?

Any advice would be appreciated.

Thanks,

Craig

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Robin Iddon 2006-04-27 16:24:56 Re: New system recommendations
Previous Message Benjamin Krajmalnik 2006-04-27 15:15:43 Re: New system recommendations