From: Craig Servin <cservin@cromagnon.com>
To: pgsql-admin@postgresql.org
Subject: Alter table alter column using question
Date: Thu, 27 Apr 2006 10:40:29 -0500
Message-ID: <200604271040.29326.cservin@cromagnon.com> (raw)
In-Reply-To: <C0764FC0.2D1A%ketema@gmail.com>
References: <C0764FC0.2D1A%ketema@gmail.com>
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
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: cservin@cromagnon.com
Subject: Re: Alter table alter column using question
In-Reply-To: <200604271040.29326.cservin@cromagnon.com>
References: <C0764FC0.2D1A%ketema@gmail.com> <200604271040.29326.cservin@cromagnon.com>
* 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