Re: boolean isn't boolean?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Marc Britten <mbritten(at)cybernet-usa(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: boolean isn't boolean?
Date: 2000-06-22 16:17:10
Message-ID: Pine.LNX.4.21.0006220407560.19929-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-06-22 16:23:11 Re: Limits in subqueries...
Previous Message Stuart Grimshaw 2000-06-22 16:16:29 PHP Install with Postgres support.