Re: Binary data type with other output method - Mailing list pgsql-hackers

From Andreas 'ads' Scherbaum
Subject Re: Binary data type with other output method
Date
Msg-id 20071226232839.1c790a93@iridium.wars-nicht.de
Whole thread Raw
In response to Re: Binary data type with other output method  (Mark Mielke <mark@mark.mielke.cc>)
List 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)


pgsql-hackers by date:

Previous
From: Mark Mielke
Date:
Subject: Re: Binary data type with other output method
Next
From: Andrew Dunstan
Date:
Subject: Re: Binary data type with other output method