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

From Stephan Szabo
Subject Re: casting BOOL to somthng
Date
Msg-id 20040901072051.N70341@megazone.bigpanda.com
Whole thread Raw
In response to Re: casting BOOL to somthng  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
On Wed, 1 Sep 2004, Tom Lane wrote:

> Peter Eisentraut <peter_e@gmx.net> writes:
> > The cast to text, however, is part of the data model, and it has to be
> > both natural and universal.  I think you agree that there is no
> > universal, obvious correspondence between character strings and boolean
> > values, at least not nearly as universal and obvious as the well-known
> > correspondence between character strings and numbers.  We could pick
> > one arbitrary correspondence and implement it, and if we did we would
> > probably pick one that is consistent with the mapping used by libpq and
> > other frontends.  But doing that gains no functionality, so why bother?
>
> Actually it does gain functionality, because there are plenty of times
> when you need to manipulate a textual representation of a data value.

I don't think that doing so apart from trying to do output representation
is really a good idea in general (and for that I'd think something like
to_char would be more appropriate). For example, if people are casting
macaddrs to text in order to substring them or some such, that implies
to me that there are additional operations on macaddr we should have.


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: casting BOOL to somthng
Next
From: Michael Kleiser
Date:
Subject: Re: German "umlaut insensitive" query