diff -Nurb postgresql-8.1.4/src/backend/utils/adt/numutils.c postgresql-8.1.4-patched/src/backend/utils/adt/numutils.c --- postgresql-8.1.4/src/backend/utils/adt/numutils.c 2005-12-01 00:10:16.000000000 +0100 +++ postgresql-8.1.4-patched/src/backend/utils/adt/numutils.c 2006-10-13 12:05:34.000000000 +0200 @@ -55,6 +55,9 @@ * Unlike plain atoi(), this will throw ereport() upon bad input format or * overflow. */ + +bool empty_equals_0; + int32 pg_atoi(char *s, int size, int c) { @@ -68,6 +71,9 @@ if (s == NULL) elog(ERROR, "NULL pointer"); if (*s == 0) + if(empty_equals_0) + return (int32)0; + else ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for integer: \"%s\"", diff -Nurb postgresql-8.1.4/src/backend/utils/misc/guc.c postgresql-8.1.4-patched/src/backend/utils/misc/guc.c --- postgresql-8.1.4/src/backend/utils/misc/guc.c 2006-05-21 22:11:02.000000000 +0200 +++ postgresql-8.1.4-patched/src/backend/utils/misc/guc.c 2006-10-13 12:05:57.000000000 +0200 @@ -97,6 +97,7 @@ extern int CommitSiblings; extern char *default_tablespace; extern bool fullPageWrites; +extern bool empty_equals_0; #ifdef TRACE_SORT extern bool trace_sort; @@ -395,6 +396,14 @@ static struct config_bool ConfigureNamesBool[] = { { + {"empty_equals_0", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, + gettext_noop("Treats the empty string as 0 when dealing with integers"), + NULL + }, + &empty_equals_0, + false, NULL, NULL + }, + { {"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD, gettext_noop("Enables the planner's use of sequential-scan plans."), NULL