Re: [PATCHES] Cast null to int4 upgrading from Version 7.2

2006-11-17 Thread Mario Weilguni
you might be interested using the patch attached, it introduces a new GUC variable named empty_equals_0, allowing to set this per database: alter database xyz set empty_equals_0 to true; I've written and used this patch for internal purpose, and take no responsibilty at all, but it's working

[PATCHES] Cast null to int4 upgrading from Version 7.2

2006-11-16 Thread Dwight Emmons
My company is currently using version 7.2 and would like to convert to the latest version. Unfortunately, version 7.3 implicitly casts a null text to an int4. For example: Create table employee_table ( employee_id integer employee_name text employee_address text); Select *

Re: [PATCHES] Cast null to int4 upgrading from Version 7.2

2006-11-16 Thread Andrew Dunstan
Dwight Emmons wrote: [Why did you post this to pgsql-patches of all places? it should properly have gone to pgsql-general, I think] My company is currently using version 7.2 and would like to convert to the latest version. Unfortunately, version 7.3 implicitly casts a null text to an int4.

Re: [PATCHES] Cast null to int4 upgrading from Version 7.2

2006-11-16 Thread Jim Nasby
On Nov 16, 2006, at 3:10 PM, Neil Conway wrote: Yes, this is a common problem for people upgrading from 7.2. I think the long-term fix is to change your queries: comparing an integer with '' is not sensible. That is: SELECT * FROM employee_table WHERE employee_id = 0; is the right way to

Re: [PATCHES] Cast null to int4 upgrading from Version 7.2

2006-11-16 Thread Peter Eisentraut
Jim Nasby wrote: As a less invasive alternative, I *think* you could create an SQL function for casting text to int that treated '' as 0, and then replace the built-in CAST with that. Won't work. You need to replace the data type input function. -- Peter Eisentraut