Re: How to implement Microsoft Access boolean (YESNO) - Mailing list pgsql-sql

From Greg Stark
Subject Re: How to implement Microsoft Access boolean (YESNO)
Date
Msg-id 87r76yusi3.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: How to implement Microsoft Access boolean (YESNO)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: How to implement Microsoft Access boolean (YESNO)  (PFC <lists@peufeu.com>)
Re: How to implement Microsoft Access boolean (YESNO)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Greg Stark <gsstark@mit.edu> writes:
> > "Jesper K. Pedersen" <jkp@solnet.homeip.net> writes:
> >> Having checked the I/O format it seems that MS Access exports the
> >> values of a YESNO field as 0 and 1
> 
> > If only Postgres's boolean type were as helpful.
> 
> There's a cast to int in 8.1, and you can roll-your-own easily in prior
> releases ...

The annoying thing about is that in just about any client language you'll get
't' and 'f' by default and both will evaluate to false. So any user who tries
to do things the obvious way like this will get a surprise:
if ($db->query("select canlogin from users where userid = ?",$userid)) {  ...}

Is there an implicit cast from ints? So if I pass a 0 or 1 argument for a
boolean parameter now it'll work? That definitely didn't work in the past.

-- 
greg



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to implement Microsoft Access boolean (YESNO)
Next
From: Bruno Wolff III
Date:
Subject: Re: non-equi self-join optimization