Re: 0/1 vs true/false

From: <terry(at)ashtonwoodshomes(dot)com>
To: "'Franco Bruno Borghesi'" <franco(at)akyasociados(dot)com(dot)ar>, "'Jochem van Dieten'" <jochemd(at)oli(dot)tudelft(dot)nl>
Cc: "'Jean-Christian Imbeault'" <jc(at)mega-bucks(dot)co(dot)jp>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: 0/1 vs true/false
Date: 2003-07-23 14:37:04
Message-ID: 00bb01c35127$e3a19de0$2766f30a@development.greatgulfhomes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I doubt it, same way '0' and '1' have not disappeared despite 0 and 1 have.
There is still a function that can convert a string to a boolean. There is
no function to convert an integer to a boolean, which is why 0 and 1 do not
work but '0', 'f', '1', 't' all work.

Terry Fielder
Manager Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
terry(at)greatgulfhomes(dot)com
Fax: (416) 441-9085

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Franco Bruno
Borghesi
Sent: Wednesday, July 23, 2003 10:21 AM
To: Jochem van Dieten
Cc: Jean-Christian Imbeault; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] 0/1 vs true/false

This makes me wonder, what about 't' and 'f'?... will they disappear in
newer versions of postgreSQL?

On Wed, 2003-07-23 at 09:21, Jochem van Dieten wrote:
Jean-Christian Imbeault wrote:
> Just having a small argument with an application developer ...
>
> is using 0/1 for boolean types SQL compliant? I am trying to convince
> him that the proper SQL compliant (and postgresql compliant) syntax is
> true/false but he won't budge ...
>
> The app as currently written no longer works with postgres because they
> code uses 0/1 instead of the now enforced true/false for boolean types.
>
> Can someone point me to an SQL spec and section where this is clearly
> stated out?

Would this be what you are looking for:

ISO/IEC 9075-2:1999 (E) ©ISO/IEC
5.3 <literal>
(..)
<boolean literal> ::=
TRUE
| FALSE
| UNKNOWN

Additionally about UNKNOWN:

ISO/IEC 9075-2:1999 (E) ©ISO/IEC
4.6 Boolean types
The data type boolean comprises the distinct truth values true
and false . Unless prohibited by a NOT NULL constraint, the
boolean data type also supports the unknown truth value as the
null value. This specification does not make a distinction
between the null value of the boolean data type and the unknown
truth value that is the result of an SQL <predicate>, <search
condition>, or <boolean value expression>; they may be used
interchangeably to mean exactly the same thing.

HTH,
Jochem

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-07-23 14:43:31 Re: 0/1 vs true/false
Previous Message Claudio Lapidus 2003-07-23 14:29:17 Re: 0/1 vs true/false