Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6558B632FB5; Wed, 10 Feb 2010 08:04:56 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 40085-10; Wed, 10 Feb 2010 12:04:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f224.google.com (mail-fx0-f224.google.com [209.85.220.224]) by mail.postgresql.org (Postfix) with ESMTP id 36EF8632E37; Wed, 10 Feb 2010 08:04:45 -0400 (AST) Received: by fxm24 with SMTP id 24so301104fxm.3 for ; Wed, 10 Feb 2010 04:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type; bh=kmO/oGiJiQafU+QcTEeMlxmFucrgD7sFUaaltsPoEMY=; b=Zr7nsQbZOai6CZw+7loCV0/X/xcEizYKfuPjiSg0gJb9U1fFoSgJo+gJJIYHNrsVN/ DuEhkTboFeG3ioBfKFZbACKUHRuQOXz0Le5erc6URVyKblIIKEeV32anLi1qXTPGnseJ x9CokIX4OlkoZIcNJD7vQp/LDfpCsCcFCyXTk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=Mh3r9uF9raUngEVa5Ph3s9vEoEy42BpJBbcNOHYK+oqBWg6bGdhjlQEBkx5zKjrqqQ Ck4pjQN6erH5mFZOGujfdQ4MPPcuuNfAkYdCfJ5LF1sP47lwyeEZUxSVKYoPWiCCW02q VOCIgji8wgiyT4Xl+SoTlSqSd7ArM03idVMGc= MIME-Version: 1.0 Received: by 10.102.209.14 with SMTP id h14mr130233mug.25.1265803483196; Wed, 10 Feb 2010 04:04:43 -0800 (PST) From: Thom Brown Date: Wed, 10 Feb 2010 12:04:23 +0000 Message-ID: Subject: PHP and PostgreSQL boolean data type To: pgsql-php@postgresql.org, PGSQL Mailing List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.359 tagged_above=-10 required=5 tests=AWL=0.240, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/429 X-Sequence-Number: 159205 Hi, A long-standing problem we've had with PostgreSQL queries in PHP is that the returned data for boolean columns is the string 'f' instead of the native boolean value of false. An obvious example of this would be for a table with users and their boolean registered status: Select user, registered From users; Then getting a row from the result would reveal: array('user' => 'thomb', registered => 'f'); Another problem is with arrays, where they are difficult to parse as they also come through as plain strings with no binary alternative. Is this a limitation of libpq or a flawed implementation in the php library? And if this is just the case for backwards-compatibility, is there a way to switch it to a more sensible PHP data type? Thanks Thom