Re: PHP and PostgreSQL boolean data type - Mailing list pgsql-php

From Jasen Betts
Subject Re: PHP and PostgreSQL boolean data type
Date
Msg-id hl364i$16m$3@reversiblemaps.ath.cx
Whole thread Raw
In response to PHP and PostgreSQL boolean data type  (Thom Brown <thombrown@gmail.com>)
List pgsql-php
On 2010-02-10, Thom Brown <thombrown@gmail.com> wrote:
> 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?

cast to integer when selecting and to boolean when writing?


pgsql-php by date:

Previous
From: Chris
Date:
Subject: Re: PHP and PostgreSQL boolean data type
Next
From: Steve.Toutant@inspq.qc.ca
Date:
Subject: launch a php script from a trigger function