boolean isn't boolean?

Started by Marc Brittenalmost 26 years ago8 messagesgeneral
Jump to latest
#1Marc Britten
mbritten@cybernet-usa.com

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

this goes against everything i know, i'm doing a php app(first time php
first time postgres, but i have extensive knowledge of oracle, sybase, and
more than a bit of MS SQL 6.5 n 7, plus extensive knowledge of c/c++ and
java and perl and elisp)

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

i just need to know that there was some actual logic behind this.

thanks,

marc britten

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Marc Britten (#1)
Re: boolean isn't boolean?

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

#3Marc Britten
mbritten@cybernet-usa.com
In reply to: Peter Eisentraut (#2)
RE: boolean isn't boolean?

normaly i wouldn't be this picky but......

language-lawyer version.. you used the wrong version of the lang, the docs
say it complies to SQL3, which has completely different wording than SQL99

-----Original Message-----
From: Peter Eisentraut [mailto:peter_e@gmx.net]
Sent: Thursday, June 22, 2000 11:17 AM
To: Marc Britten
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] boolean isn't boolean?

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. :-)

#4Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: Marc Britten (#3)
Re: boolean isn't boolean?

language-lawyer version.. you used the wrong version of the lang, the
docs say it complies to SQL3, which has completely different wording
than SQL99

Do you have a reference for an SQL99 document? Preferably on-line or in
a form similar to what we've found for SQL3-1999?

- Thomas

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Thomas Lockhart (#4)
Re: boolean isn't boolean?

Thomas Lockhart writes:

Do you have a reference for an SQL99 document? Preferably on-line or in
a form similar to what we've found for SQL3-1999?

ftp://jerry.ece.umassd.edu/isowg3/x3h2/Standards/ansi-iso-9075-[12345]-1999.txt

This seems to be the real copyrighted deal, so get yours while it's there.

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

#6Peter Eisentraut
peter_e@gmx.net
In reply to: Marc Britten (#3)
RE: boolean isn't boolean?

Marc Britten writes:

language-lawyer version.. you used the wrong version of the lang, the docs
say it complies to SQL3, which has completely different wording than SQL99

SQL3 isn't a standard, the term used to be employed to mean "the potential
successor to ISO/IEC 9075:1992", which turned out to be ISO/IEC 9075:1999,
which is what I quoted.

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

#7Bruce Momjian
bruce@momjian.us
In reply to: Peter Eisentraut (#5)
Re: boolean isn't boolean?

[ Charset ISO-8859-1 unsupported, converting... ]

Thomas Lockhart writes:

Do you have a reference for an SQL99 document? Preferably on-line or in
a form similar to what we've found for SQL3-1999?

ftp://jerry.ece.umassd.edu/isowg3/x3h2/Standards/ansi-iso-9075-[12345]-1999.txt

This seems to be the real copyrighted deal, so get yours while it's there.

Seems we need an ANSI SQL napster server. :-)

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#8Ross J. Reedstrom
reedstrm@rice.edu
In reply to: Bruce Momjian (#7)
Re: boolean isn't boolean?

On Sat, Jun 24, 2000 at 12:29:14PM -0400, Bruce Momjian wrote:

[ Charset ISO-8859-1 unsupported, converting... ]

Thomas Lockhart writes:

Do you have a reference for an SQL99 document? Preferably on-line or in
a form similar to what we've found for SQL3-1999?

ftp://jerry.ece.umassd.edu/isowg3/x3h2/Standards/ansi-iso-9075-[12345]-1999.txt

This seems to be the real copyrighted deal, so get yours while it's there.

Seems we need an ANSI SQL napster server. :-)

Hmm, the README at that site says:

----
This is the primary server for the /isowg directory. A mirror site
is available at math0.math.ecu.edu. math0.math.ecu.edu is updated
twice a day.
----

So, it looks like it's the offical repository for (at least) the US part
of the iso working groups. Traditionally, those docs have been freely
available until the standard is actually accepted. Perhaps these are
working drafts for the next version? OR someone slipped up, and forgot
to remove them when the standard was voted on? Is the voting done? Has
ANSI voted? Will Lassie find Jimmy in the well?

Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005