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

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



pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: casting BOOL to somthng
Next
From: Stephan Szabo
Date:
Subject: Re: casting BOOL to somthng