Re: casting BOOL to somthng

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: sad <sad(at)bankir(dot)ru>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: casting BOOL to somthng
Date: 2004-09-01 07:03:51
Message-ID: 143DAF2B-FBE5-11D8-A2A0-000A95C88220@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Sep 1, 2004, at 2:55 PM, sad wrote:

> On Wednesday 01 September 2004 10:38, Michael Glaesemann wrote:
>> On Sep 1, 2004, at 2:41 PM, sad wrote:
>>> On Wednesday 01 September 2004 09:24, Stephan Szabo wrote:
>>>> There's a fairly accepted convention for integer representations.
>>>> There's no such convention for boolean representations.
>>>
>>> then why do you print its value on a screen ?!
>>
>> Perhaps because if you don't print *something* you can't see it?
>
> since you printed it you poke a convention (of casting to string)

OT: 'pick' or 'choose'. 'Poke' means something else entirely.

> if you can print it on screen why not to print it in string?

I can see your point, but I think that representing the value and
casting the value to another type are two different things. Given, as
Stephen pointed out, that there is no standard convention for
representing BOOLEAN values, whatever the choice is is not going to
satisfy nearly anyone. For me, I would *not* want TRUE to be
represented as 't', nor would I want to have to set up a separate cast
(or formating function, or CASE statement) to make it print 'TRUE'.
Others, I'm sure, would rather see it as 'true' (lowercase). Why should
they be penalized to suit me?

I've seen very few people ask for a cast from BOOLEAN to TEXT. Given
the apparently limited number of people who desire it, and the various
ways BOOLEAN may be represented as text, I think it's much better to
leave it up to the individual user to define their own cast to do so,
and PostgreSQL provides an easy method to do so.

Michael Glaesemann
grzm myrealbox com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2004-09-01 07:16:03 Re: casting BOOL to somthng
Previous Message Peter Eisentraut 2004-09-01 06:59:08 Re: casting BOOL to somthng