Re: [PATCHES] Casting INT4 to BOOL...

2004-10-14 Thread Bruce Momjian
This has been saved for the 8.1 release: http:/momjian.postgresql.org/cgi-bin/pgpatches2 --- Sean Chittenden wrote: Is there any reason why the backend doesn't cast an unquoted integer to a boolean value?

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-12 Thread Peter Eisentraut
Am Montag, 11. Oktober 2004 15:50 schrieb Tom Lane: I agree with Michael's position. I don't like implicit/automatic casts any more than Peter does, but I don't see a strong argument against providing explicit casts. I find the chosen mapping to be somewhat arbitrary and artifical. (2::int =

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-12 Thread Sean Chittenden
The patch treats any non-zero value as true. Is that the behavior we want, or should we only allow 1 as an integer representation of true? (I'm not sure myself, I just don't think copying C here is necessarily the best guide.) I would posit that this is the desired behavior as it's consistent

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-12 Thread Andrew Dunstan
Sean Chittenden said: Perl's decision to let any non-empty string be true doesn't mean a database should take any nonfalse-like value and assume it should be true. 42::BOOL == TRUE, on the other hand, has a long mathematical president wherein non-zero values are true and zero values are

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Peter Eisentraut
Sean Chittenden wrote: Alrighty. Do you want an updated patch for the single character tweak or can you futz with it before committing? :) I oppose casts from boolean to integer or vice versa. Anyway, with Qt, it converts bool values to integers. I think Qt's probably right on this front

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Michael Paesold
Peter Eisentraut wrote: Sean Chittenden wrote: Alrighty. Do you want an updated patch for the single character tweak or can you futz with it before committing? :) I oppose casts from boolean to integer or vice versa. Even _explicit_ casts only? It would not have any bad side effects on people

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Tom Lane
Michael Paesold [EMAIL PROTECTED] writes: Peter Eisentraut wrote: I oppose casts from boolean to integer or vice versa. Even _explicit_ casts only? It would not have any bad side effects on people not using it, would it? I agree with Michael's position. I don't like implicit/automatic

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Sean Chittenden
Is there any reason why the backend doesn't cast an unquoted integer to a boolean value? Hidden cross-category typecasts are evil. I'd accept this as an explicit cast ('e' in pg_cast) but not automatic. Also, what about the other direction? Providing a cast in only one direction is pretty

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes: The patch changes the system catalog; it probably ought to also bump the catalog version number. That also means this probably isn't 8.0 material, unless we make an unrelated system catalog change in a future beta (... and even then, I'm not sure if I'd

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Sean Chittenden
Is there any reason why the backend doesn't cast an unquoted integer to a boolean value? Can you add some regression tests, please? :-/ I have zero understanding or knowledge of the regression test suite. Given the simplicity of the casts, does this really need a require a regression test? I

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Tom Lane
Sean Chittenden [EMAIL PROTECTED] writes: Can you add some regression tests, please? Given the simplicity of the casts, does this really need a require a regression test? That request seems quite over-the-top to me too. The real problem here is just whether we want to be accepting a feature

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Stephan Szabo
On Mon, 11 Oct 2004, Sean Chittenden wrote: The patch treats any non-zero value as true. Is that the behavior we want, or should we only allow 1 as an integer representation of true? (I'm not sure myself, I just don't think copying C here is necessarily the best guide.) I would posit

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Tom Lane
Stephan Szabo [EMAIL PROTECTED] writes: On Mon, 11 Oct 2004, Sean Chittenden wrote: I would posit that this is the desired behavior as it's consistent with every language I can think of. However, AFAIK it's inconsitent with the type input function which supports '1' and '0' but not other

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-11 Thread Neil Conway
On Tue, 2004-10-12 at 11:54, Sean Chittenden wrote: :-/ I have zero understanding or knowledge of the regression test suite. It is trivial: add some SQL to src/test/regress/sql/foo.sql, run the tests, hand-verify the output (e.g. by looking at regression.diffs), and then copy the updated

Re: [PATCHES] Casting INT4 to BOOL...

2004-10-10 Thread Sean Chittenden
Is there any reason why the backend doesn't cast an unquoted integer to a boolean value? Hidden cross-category typecasts are evil. I'd accept this as an explicit cast ('e' in pg_cast) but not automatic. Alrighty. Do you want an updated patch for the single character tweak or can you futz with