Andreas 'ads' Scherbaum wrote:
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.



I don't see why it couldn't be switchable behaviour, just as it is in DBD::Pg.

Also, earlier you said:

> I think you'd really need a separate type.  But have you considered
> something simple like
>    CREATE DOMAIN boolint AS int CHECK (value = 0 OR value = 1)
i considered this one but this would only bring 0/1 as input, not as
output values, which is what i want.

er, what? This domain would have input and output values of 0/1.

cheers

andrew


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to