Re: boolean isn't boolean? - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: boolean isn't boolean?
Date
Msg-id Pine.LNX.4.21.0006220407560.19929-100000@localhost.localdomain
Whole thread Raw
In response to boolean isn't boolean?  (Marc Britten <mbritten@cybernet-usa.com>)
List pgsql-general
Marc Britten writes:

> why does a boolean value return a t or an f?

The language-lawyer version:

ISO/IEC 9075-5:1999 ("SQL99") 17.2 GR6

"If [the result of the query expression] is not empty, then [it] is
returned. The method of returning [it] is implementation-defined."

Then that's how this implementation defines it. :-)

> and  i have to check for $myarray[3] == 't' if i want to check for a true
> value? why?

The native libpq C API returns all data as text. It is up to the interface
that is build on libpq to do something useful with the data. For example,
embedded SQL will map query data to appropriate C data types, although I'm
not sure what it would do with boolean in particular. Similar things go
for ODBC and JDBC. So the fact is that you need to take it up with the PHP
(I guess?) guys to translate boolean values to defined/undefined or
whatever they prefer to use. But since they'd probably not break
compatibility like that you should probably provide your own wrapper
class/function/etc.


--
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Limits in subqueries...
Next
From: "Stuart Grimshaw"
Date:
Subject: PHP Install with Postgres support.