Re: [HACKERS] Binary data type with other output method

2007-12-27 Thread Andreas 'ads' Scherbaum
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

Re: [HACKERS] Binary data type with other output method

2007-12-27 Thread Andrew Dunstan
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

Re: [HACKERS] Binary data type with other output method

2007-12-27 Thread Andreas 'ads' Scherbaum
On Thu, 27 Dec 2007 08:52:15 -0500 Andrew Dunstan wrote: Andreas 'ads' Scherbaum wrote: On Wed, 26 Dec 2007 20:20:59 -0500 Andrew Dunstan wrote: 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

Re: [HACKERS] Binary data type with other output method

2007-12-27 Thread Andrew Dunstan
Andreas 'ads' Scherbaum wrote: 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. Yes, but i will loose 't', 'true', 'f' and 'false', the usual input values in

Re: [HACKERS] Binary data type with other output method

2007-12-27 Thread Andreas 'ads' Scherbaum
On Thu, 27 Dec 2007 11:39:29 -0500 Andrew Dunstan wrote: Andreas 'ads' Scherbaum wrote: 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. Yes, but i

Re: [HACKERS] Binary data type with other output method

2007-12-27 Thread Andrew Dunstan
Andreas 'ads' Scherbaum wrote: Andrew: your workaround was to create a domain which would use 0/1 ... this idea will not behave like a boolean, because it does not accept 'true'/'false'. My replacement boolean type does accept all this input values and does emit 0/1 instead of 'f'/'t'. But

Re: [HACKERS] Binary data type with other output method

2007-12-26 Thread Andreas 'ads' Scherbaum
Hello, On Tue, 25 Dec 2007 20:11:45 -0500 Tom Lane wrote: Andrew Dunstan [EMAIL PROTECTED] 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

Re: [HACKERS] Binary data type with other output method

2007-12-26 Thread Mark Mielke
Andreas 'ads' Scherbaum wrote: On Tue, 25 Dec 2007 20:11:45 -0500 Tom Lane wrote Andrew Dunstan [EMAIL PROTECTED] 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

Re: [HACKERS] Binary data type with other output method

2007-12-26 Thread Andreas 'ads' Scherbaum
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

Re: [HACKERS] Binary data type with other output method

2007-12-26 Thread Andrew Dunstan
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

[HACKERS] Binary data type with other output method

2007-12-25 Thread Andreas 'ads' Scherbaum
Hello all, i'm in the need to create a boolean datatype which returns an integer instead of the usual 't'/'f'. Before anyone starts to point me at casts: it's a lot overhead to cast some hundred occurances beside the source of trouble, if you forget one. And so i asked myself, if there is an

Re: [HACKERS] Binary data type with other output method

2007-12-25 Thread Andrew Dunstan
Andreas 'ads' Scherbaum wrote: Hello all, i'm in the need to create a boolean datatype which returns an integer instead of the usual 't'/'f'. Before anyone starts to point me at casts: it's a lot overhead to cast some hundred occurances beside the source of trouble, if you forget one. Do

Re: [HACKERS] Binary data type with other output method

2007-12-25 Thread imad
If you reduce your code you will have to leverage the bool data type. Why dont you provide a cast, I dont see an overhead in typbyval datatypes. On Dec 25, 2007 9:10 PM, Andrew Dunstan [EMAIL PROTECTED] wrote: Andreas 'ads' Scherbaum wrote: Hello all, i'm in the need to create a

Re: [HACKERS] Binary data type with other output method

2007-12-25 Thread Andreas 'ads' Scherbaum
Hello, On Tue, 25 Dec 2007 11:10:25 -0500 Andrew Dunstan wrote: Andreas 'ads' Scherbaum wrote: i'm in the need to create a boolean datatype which returns an integer instead of the usual 't'/'f'. Before anyone starts to point me at casts: it's a lot overhead to cast some hundred

Re: [HACKERS] Binary data type with other output method

2007-12-25 Thread Andreas 'ads' Scherbaum
Hello, On Tue, 25 Dec 2007 22:12:23 +0500 imad wrote: Why dont you provide a cast, I dont see an overhead in typbyval datatypes. I already have a cast from my type to PGs internal boolean ... or what do you mean? Kind regards -- Andreas 'ads' Scherbaum

Re: [HACKERS] Binary data type with other output method

2007-12-25 Thread Andrew Dunstan
Andreas 'ads' Scherbaum wrote: Hello, On Tue, 25 Dec 2007 11:10:25 -0500 Andrew Dunstan wrote: Andreas 'ads' Scherbaum wrote: i'm in the need to create a boolean datatype which returns an integer instead of the usual 't'/'f'. Before anyone starts to point me at casts: it's a lot

Re: [HACKERS] Binary data type with other output method

2007-12-25 Thread Tom Lane
Andrew Dunstan [EMAIL PROTECTED] writes: I think all you need to do it this: Take the code for boolout() in src/backend/utils/adt/bool.c, adjust it and and make it a new function boolout2. Use pgxs to make it a loadable module. Then load it and adjust the catalog entry for the bool type to

Re: [HACKERS] Binary data type with other output method

2007-12-25 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan [EMAIL PROTECTED] writes: I think all you need to do it this: Take the code for boolout() in src/backend/utils/adt/bool.c, adjust it and and make it a new function boolout2. Use pgxs to make it a loadable module. Then load it and adjust the catalog entry