X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C05D39DCA08 for ; Tue, 24 Jan 2006 01:03:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35385-04 for ; Tue, 24 Jan 2006 01:03:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id B60C79DCA72 for ; Tue, 24 Jan 2006 01:03:53 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1F1GLM-0004lb-00; Tue, 24 Jan 2006 00:03:48 -0500 To: Tom Lane Cc: Greg Stark , "Jesper K. Pedersen" , pgsql-sql@postgresql.org Subject: Re: How to implement Microsoft Access boolean (YESNO) 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> In-Reply-To: <8505.1138050132@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 24 Jan 2006 00:03:48 -0500 Message-ID: <87r76yusi3.fsf@stark.xeocode.com> Lines: 25 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.131 required=5 tests=[AWL=0.131] X-Spam-Score: 0.131 X-Spam-Level: X-Archive-Number: 200601/150 X-Sequence-Number: 23939 Tom Lane writes: > Greg Stark writes: > > "Jesper K. Pedersen" 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