Re: 0/1 vs true/false

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: 0/1 vs true/false
Date: 2003-07-23 14:43:31
Message-ID: 12960.1058971411@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-07-23 14:48:59 Re: 0/1 vs true/false
Previous Message terry 2003-07-23 14:37:04 Re: 0/1 vs true/false