Re: 0/1 vs true/false - Mailing list pgsql-general

From Tom Lane
Subject Re: 0/1 vs true/false
Date
Msg-id 12960.1058971411@sss.pgh.pa.us
Whole thread Raw
In response to Re: 0/1 vs true/false  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Responses Re: 0/1 vs true/false  (Peter Eisentraut <peter_e@gmx.net>)
Re: 0/1 vs true/false  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
Jean-Christian Imbeault <jc@mega-bucks.co.jp> writes:
> Oops, I meant to say can someone point me to a ressource (SQL standard
> and section?) which states that true/false must be used for booleans :)

Well, there is no boolean type per se in SQL92.  But there is in SQL99.
I think the most relevant part of the spec is the definition of boolean
literals in section 5.3:

         <boolean literal> ::=
                TRUE
              | FALSE
              | UNKNOWN

Note that the spec only really speaks to the question of what booleans
look like when written as constants in SQL statements.  AFAICT it does
not take a position on what representations are to be used when
transferring data into or out of the database.  So using '0' or '1' as
input to a boolean field is not contrary to spec, but merely outside
the spec (and in fact we will accept those strings for boolean...)

            regards, tom lane

pgsql-general by date:

Previous
From: "Claudio Lapidus"
Date:
Subject: Re: 0/1 vs true/false
Next
From:
Date:
Subject: Re: 0/1 vs true/false