pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Greg Stark <gsstark@mit.edu>
Cc: Jesper K. Pedersen <jkp@solnet.homeip.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to implement Microsoft Access boolean (YESNO)
Date: 24 Jan 2006 00:03:48 -0500
Message-ID: <87r76yusi3.fsf@stark.xeocode.com> (raw)
In-Reply-To: <8505.1138050132@sss.pgh.pa.us>
References: <20060122211351.371f20d8@io.solnet>
	<22008.1137962771@sss.pgh.pa.us>
	<20060122221328.433038a9@io.solnet>
	<873bjewts8.fsf@stark.xeocode.com>
	<8505.1138050132@sss.pgh.pa.us>

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




view thread (10+ messages)  latest in thread

Message-ID: <87r76yusi3.fsf@stark.xeocode.com>
Permalink:  ../87r76yusi3.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/87r76yusi3.fsf@stark.xeocode.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gsstark@mit.edu, tgl@sss.pgh.pa.us, jkp@solnet.homeip.net
  Subject: Re: How to implement Microsoft Access boolean (YESNO)
  In-Reply-To: <87r76yusi3.fsf@stark.xeocode.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