X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 891A85E4729 for ; Wed, 1 Sep 2004 11:33:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93206-07 for ; Wed, 1 Sep 2004 14:33:29 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 358325E4721 for ; Wed, 1 Sep 2004 11:33:26 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id E9FAD355FB; Wed, 1 Sep 2004 07:33:29 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id E83A535317; Wed, 1 Sep 2004 07:33:29 -0700 (PDT) Date: Wed, 1 Sep 2004 07:33:29 -0700 (PDT) From: Stephan Szabo To: Tom Lane Cc: Peter Eisentraut , sad , Michael Glaesemann , pgsql-sql@postgresql.org Subject: Re: casting BOOL to somthng In-Reply-To: <6204.1094048394@sss.pgh.pa.us> Message-ID: <20040901072051.N70341@megazone.bigpanda.com> References: <200408311306.25545.sad@bankir.ru> <8AF2CE57-FBE1-11D8-A2A0-000A95C88220@myrealbox.com> <200409010955.45834.sad@bankir.ru> <200409010859.08037.peter_e@gmx.net> <6204.1094048394@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/16 X-Sequence-Number: 18862 On Wed, 1 Sep 2004, Tom Lane wrote: > Peter Eisentraut 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.