Re: int4 <-> bool casts
От | Tom Lane |
---|---|
Тема | Re: int4 <-> bool casts |
Дата | |
Msg-id | 24579.1109619439@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: int4 <-> bool casts (Peter Eisentraut <peter_e@gmx.net>) |
Список | pgsql-patches |
Peter Eisentraut <peter_e@gmx.net> writes: > I believe I would have objected to an int/bool cast. I do so now > anyway. This was already discussed and agreed to. Since it's an explicit-only cast, I see no harm in it. And it's certainly been requested often enough. > - 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.) On those grounds we should disallow most of the numeric-category casts. > - It's an arbitary definition that is not obviously supported by > mathematical or similar principles. Nonetheless, the convention 0=false, 1=true is widely recognized. > - It opens the door for other silly casts like empty string => false, > non-empty string => true. I haven't seen any requests for any such casts. This cast is responding to market demand, no more. > - It's unnecessary because you can express the same thing using other > expressions that clearly state what they do. Basically what this is for is building in a feature that people otherwise build for themselves. On the grounds of "it's unnecessary" we could throw away large chunks of Postgres :-) regards, tom lane
В списке pgsql-patches по дате отправления: