Re: Binary data type with other output method

From: Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Binary data type with other output method
Date: 2007-12-26 22:28:39
Message-ID: 20071226232839.1c790a93@iridium.wars-nicht.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 26 Dec 2007 17:12:33 -0500 Mark Mielke wrote:

> Andreas 'ads' Scherbaum wrote:
> > The reason for my question is: PHP (yes *grumble*) does not recognize
> > boolean columns but instead makes a simple string from a PG boolean.
> >
> > So every time you select a boolean column in PHP, you cannot use
> > expressions like:
> >
> > if (!$bool)
> >
> > because 't' and 'f' give TRUE in PHP.
> >
> > I was begged many times by our people coding PHP to find a workaround
> > for this problem
> If you find a good solution, feel free to share. :-)
>
> I have had this annoy me for about 6 months now. I forget what
> configuration change I did, but booleans stopped working for exactly
> this reason (where they did work in the past). For lack of time or care,
> my PHP now has added === 't' ? true : false in various places... :-)

It has worked once? Never seen this working in PHP. I know, that some
other database drivers for PHP do a better job here, but pure PHP fails.

Yes, i can cast every result in every query or i can use your
workaround, but this is silly and a common source of errors. Since this
is a logic error, not a syntax error, you never find out in the first
place but only with debugging.

Kind regards

--
Andreas 'ads' Scherbaum
Failure is not an option. It comes bundled with your Microsoft product.
(Ferenc Mantfeld)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-12-27 01:20:59 Re: Binary data type with other output method
Previous Message Mark Mielke 2007-12-26 22:12:33 Re: Binary data type with other output method