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-27 12:09:26 |
Message-ID: | 20071227130926.49513b71@iridium.wars-nicht.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 26 Dec 2007 20:20:59 -0500 Andrew Dunstan 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.
>
> The answer is surely to fix the PHP driver rather than trying to mangle
> Postgres. The Perl DBD::Pg driver does not suffer this problem, so it
> can certainly be worked around (in fact in DBD::Pg you get a choice if
> 1/0 or t/f values for booleans).
This PHP driver is in use since years, do you really expect they will
fix this bug and make thousands of applications fail? Everyone like
Mark who posted an example earlier would have to change the PHP code
if the variable is now a true/false boolean instead a 't'/'f' string.
No, i don't expect a bugfix here. Newer drivers like PDO seems to
behave correct but this will not help if you cannot use this driver.
As i told earlier, this is really a PHP bug, since libpq knows the type
of every returned row in PQftype. DBD::Pg and PHP PDO seems to use this
information.
Anyway, this does not help in my case. My question was if there is a
shorter way to create a boolean type with another output than to
recreate all the casts, operators ect. If not, i have to go with this
approach but maybe someone else has a more elegant idea.
Kind regards
--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2007-12-27 13:19:05 | Re: duplicate columns with COPY |
Previous Message | Tomasz Ostrowski | 2007-12-27 10:09:06 | Re: Spoofing as the postmaster |