From: | Michael Glaesemann <grzm(at)myrealbox(dot)com> |
---|---|
To: | sad <sad(at)bankir(dot)ru> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: casting BOOL to somthng |
Date: | 2004-08-31 13:49:05 |
Message-ID: | 8618C5BA-FB54-11D8-A2A0-000A95C88220@myrealbox.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2004-08-31 14:18:00 | Re: Arbitrary precision arithmatic with pgsql |
Previous Message | Rajesh Kumar Mallah | 2004-08-31 13:15:59 | Re: Arbitrary precision arithmatic with pgsql |