Re: enums

Поиск
Список
Период
Сортировка
От Rod Taylor
Тема Re: enums
Дата
Msg-id 1130466207.846.40.camel@home
обсуждение исходный текст
Ответ на Re: enums  ("Jim C. Nasby" <jnasby@pervasive.com>)
Список pgsql-hackers
> > It would just be a standard "ALTER TABLE foo ALTER COLUMN bar TYPE 
> > newtype USING expression" operation. You would write a function that 
> > took a value of the old type and returned a value of the new type and 
> > use a cll to that function in the expression. Since these would be named 
> > types, unlike the case in mysql where they are anonymously defined 
> > inline, this would present no difficulties at all.
> 
> But why force a re-write of the entire table just to change the name of
> something?
> 
> Or is ALTER COLUMN TYPE smart enough to not touch anything if the
> mapping function is equality?

Nearly all ALTER TABLE commands are processed in the same way. In fact,
in some cases they are combined (ADD column is broken down then
re-combined later for a single rewrite).

You could pretty easily add this type of logic to skip the rewrite stage
if not needed.

-- 



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: enums
Следующее
От: Philip Yarra
Дата:
Сообщение: pl/pgsql breakage in 8.1b4?