Re: Is it possible to have multiple names for a column? - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Is it possible to have multiple names for a column?
Date
Msg-id 1158263095.24726.21.camel@state.g2switchworks.com
Whole thread Raw
In response to Is it possible to have multiple names for a column?  (felix@crowfix.com)
List pgsql-general
On Thu, 2006-09-14 at 14:18, felix@crowfix.com wrote:
> We have a need to rename some columns, but since we can't update both
> the database and the programs instantly, we'd like to temporarily
> assign both names to the same column while the updates are in
> progress.  Something like this would be super nifty :-)
>
>     ALTER TABLE howdy_doody ADD NAME xyzzy TO COLUMN plugh;
>
> I am pretty certain no such SQL command exists.  But is it possible to
> do something sneaky to the internal tables so that two names point to
> the same columnand everything just works?  Everything meaning updates,
> inserts, etc, not further ALTER TABLE and so on.

You could create a view, make the two outside names reference the one
inside name, and create a trigger to update based on which one if given
data and throw an error if you try to update both columns at the same
time.

Sounds like a lot of work though.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is it possible to have multiple names for a column?
Next
From: Poul Møller Hansen
Date:
Subject: Sun Java Studio Creator and PostgreSQL