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

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Is it possible to have multiple names for a column?
Дата
Msg-id 1158263095.24726.21.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на Is it possible to have multiple names for a column?  (felix@crowfix.com)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Is it possible to have multiple names for a column?
Следующее
От: Poul Møller Hansen
Дата:
Сообщение: Sun Java Studio Creator and PostgreSQL