Re: int4 <-> bool casts

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: int4 <-> bool casts
Дата
Msg-id 200502280124.56320.peter_e@gmx.net
обсуждение исходный текст
Ответ на int4 <-> bool casts  (Neil Conway <neilc@samurai.com>)
Ответы Re: int4 <-> bool casts  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Neil Conway wrote:
> > I believe I would have objected to an int/bool cast. I do so now
> > anyway.
>
> On what grounds?

I can think of a couple of reasons:

- Casting back and forth does not preserve information.  (This may be
true for some other type pairs as well, but in this case it's true in
almost every instance.)

- It's an arbitary definition that is not obviously supported by
mathematical or similar principles.

- It opens the door for other silly casts like empty string => false,
non-empty string => true.

- It's unnecessary because you can express the same thing using other
expressions that clearly state what they do.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: int4 <-> bool casts
Следующее
От: "Magnus Hagander"
Дата:
Сообщение: win32 libpq build broken