From: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: BOOLEAN data type?
Date: Fri, 13 Apr 2001 09:08:03 -0700
Message-ID: <web-37672@davinci.ethosmedia.com> (raw)
Folks:
I had assumed that the BOOL column type was a tru boolean. That is, I
wrote some functions on the understand that, given table def:
CREATE TABLE order_details (
order_detail_id SERIAL NOT NULL PRIMARY KEY,
detail_id INT4 NOT NULL,
order_usq INT4 NOT NULL,
detail_required BOOL DEFAULT FALSE );
That the following query:
SELECT detail_id FROM order_detials
WHERE order_usq = 7703 AND detail_required;
... should be equivalent to:
SELECT detail_id FROM order_detials
WHERE order_usq = 7703 AND detail_required = TRUE;
However, in testing (7.1 RC2), the query turned out to mean this:
SELECT detail_id FROM order_detials
WHERE order_usq = 7703 AND detail_required IS NOT NULL;
... throwing off a lot of my results until I figured it out.
Can someone explain this to me? I thought the whole point of a BOOL
data type was that it could be treated as a Boolean value, and used for
testing and comparison without and "= TRUE" or "= FALSE". What's going
on here?
-Josh
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com
Subject: Re: BOOLEAN data type?
In-Reply-To: <web-37672@davinci.ethosmedia.com>
References: <web-37672@davinci.ethosmedia.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox