Re: casting BOOL to somthng - Mailing list pgsql-sql

From Michael Glaesemann
Subject Re: casting BOOL to somthng
Date
Msg-id 8618C5BA-FB54-11D8-A2A0-000A95C88220@myrealbox.com
Whole thread Raw
In response to Re: casting BOOL to somthng  (sad <sad@bankir.ru>)
Responses Re: casting BOOL to somthng  (sad <sad@bankir.ru>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Rajesh Kumar Mallah
Date:
Subject: Re: Arbitrary precision arithmatic with pgsql
Next
From: Jan Wieck
Date:
Subject: Re: Arbitrary precision arithmatic with pgsql