Re: trouble caused by change in 7.3 handling of '' in integer

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Vivek Khera <khera(at)kcilink(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: trouble caused by change in 7.3 handling of '' in integer
Date: 2002-12-19 17:52:07
Message-ID: 200212191752.gBJHq7Y26864@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Vivek Khera wrote:
> >>>>> "BM" == Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>
> BM> How about if I give you a patch against 7.3 that allows '' as 0, and you
> BM> ask if the author can distribute it and get his code changed for 7.4?
>
> That would be great. Actually what would be best is if the code could
> log a warning (with the full query) every time it happened, then it
> would be easy to run the app for a while and find all the places it
> happens. RT dynamically creates its queries so this would be the
> easiest way to fix it up. Then RT could be fixed up and not need any
> patches to PG.

OK, patch attached and tested:

test=> CREATE TABLE test(x int);
CREATE TABLE
test=> INSERT INTO test VALUES ('');
WARNING: pg_atoi: zero-length string
INSERT 140191 1
test=> SELECT x FROM test;
x
---
0
(1 row)

However, the regression tests will fail now because we explicitly test
for '' to generate an error.

I added my name, date, and purpose as a comment in the patched code.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 856 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Larry Rosenman 2002-12-19 17:55:59 Re: trouble caused by change in 7.3 handling of '' in
Previous Message Tom Lane 2002-12-19 17:44:59 Re: Table Timemachine!