From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Binary data type with other output method |
Date: | 2007-12-27 13:52:15 |
Message-ID: | 4773AE0F.80705@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Joris Dobbelsteen | 2007-12-27 14:42:57 | Re: Sorting Improvements for 8.4 |
Previous Message | Peter Eisentraut | 2007-12-27 13:19:05 | Re: duplicate columns with COPY |