Re: Binary data type with other output method

From: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
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-26 22:12:33
Message-ID: 4772D1D1.1080206@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andreas 'ads' Scherbaum wrote:
> On Tue, 25 Dec 2007 20:11:45 -0500 Tom Lane wrote
>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>> 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.
>
> 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... :-)

Cheers,
mark

--
Mark Mielke <mark(at)mielke(dot)cc>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas 'ads' Scherbaum 2007-12-26 22:28:39 Re: Binary data type with other output method
Previous Message Andreas 'ads' Scherbaum 2007-12-26 17:18:22 Re: Binary data type with other output method