Re: ALTER TABLE ( smallinto -> boolean ) ...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER TABLE ( smallinto -> boolean ) ...
Дата
Msg-id 6793.1125610242@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: ALTER TABLE ( smallinto -> boolean ) ...  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: ALTER TABLE ( smallinto -> boolean ) ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
Список pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> Sure you can.  Make a SQL or PLPGSQL function that does the conversion
>> you want and then create a cast using it.

> That probably won't help him much with "values(0)":

If I remember the context of the original request, it wasn't about that
anyway, but about dealing with an existing smallint column.

> Is there a way to make the builtin int to bool cast implicit?

I think you'd have to go and hack the pg_cast entry ... but that cast is
new in 8.1 anyway, so it doesn't apply to Marc's problem (yet).

If we want to make it cover that specific scenario, changing it to AS
ASSIGNMENT would be sufficient; I don't think it needs to be IMPLICIT.
(I generally find cross-type-category implicit casts to be dangerous.)
        regards, tom lane


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: ALTER TABLE ( smallinto -> boolean ) ...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Using multi-locale support in glibc