Re: Is it possible to have multiple names for a column?

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: felix(at)crowfix(dot)com
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is it possible to have multiple names for a column?
Date: 2006-09-14 19:44:55
Message-ID: 1158263095.24726.21.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2006-09-14 at 14:18, felix(at)crowfix(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Poul Møller Hansen 2006-09-14 20:40:01 Sun Java Studio Creator and PostgreSQL
Previous Message Tom Lane 2006-09-14 19:29:46 Re: Is it possible to have multiple names for a column?