On Aug 31, 2004, at 8:24 PM, sad wrote:

and i am still desire to know _WHY_ there are no predefined cast for BOOL ?
and at the same time there are predefined casts for INT and FLOAT......

I think the main reason is what is the proper textual representation of BOOLEAN? True, PostgreSQL returns 't' as a representation for the BOOLEAN value TRUE, but some people might want it to return 'TRUE' or 'true' or other representations. Picking one is perhaps arbitrary.


In a similar vein, some people would like to cast BOOLEAN to INTEGER, as often BOOLEAN TRUE and BOOLEAN FALSE are represented as INTEGER 1 and INTEGER 0, respectively, in some systems. However, other systems use different INTEGER representations such as INTEGER 1 and INTEGER -1 for BOOLEAN TRUE and FALSE, respectively. Again, the choice of how to cast BOOLEAN to INTEGER is kind of arbitrary.

Luckily PostgreSQL provides convenient ways of making user-defined casts.

Just my thoughts.

Michael Glaesemann
grzm myrealbox com


---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Reply via email to