pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Michael Glaesemann <grzm@myrealbox.com>
To: sad <sad@bankir.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: casting BOOL to somthng
Date: Tue, 31 Aug 2004 22:49:05 +0900
Message-ID: <8618C5BA-FB54-11D8-A2A0-000A95C88220@myrealbox.com> (raw)
In-Reply-To: <200408311524.16036.sad@bankir.ru>
References: <200408311306.25545.sad@bankir.ru>
<4B1E87BC-FB36-11D8-A2A0-000A95C88220@myrealbox.com>
<200408311524.16036.sad@bankir.ru>
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
view thread (19+ messages) latest in thread
Message-ID: <8618C5BA-FB54-11D8-A2A0-000A95C88220@myrealbox.com> Permalink: ../8618C5BA-FB54-11D8-A2A0-000A95C88220@myrealbox.com/ Also on: postgresql.org/message-id/8618C5BA-FB54-11D8-A2A0-000A95C88220@myrealbox.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-sql@postgresql.org Cc: grzm@myrealbox.com, sad@bankir.ru Subject: Re: casting BOOL to somthng In-Reply-To: <8618C5BA-FB54-11D8-A2A0-000A95C88220@myrealbox.com> References: <200408311306.25545.sad@bankir.ru> <4B1E87BC-FB36-11D8-A2A0-000A95C88220@myrealbox.com> <200408311524.16036.sad@bankir.ru> <8618C5BA-FB54-11D8-A2A0-000A95C88220@myrealbox.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox