Thread: pg_atoi: zero length string

pg_atoi: zero length string

From
Larry Rosenman
Date:
I know, it's late, and I assume this is intentional, but wanted to check:

on 7.2.3:
$ psql
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms      \h for help with SQL commands      \? for help on internal slash commands
    \g or terminate with semicolon to execute query      \q to quit
 

ler=# \d     List of relations   Name     | Type  | Owner
-------------+-------+-------nat_dal_est | table | ler
(1 row)

ler=# create table z_test(t int);
CREATE
ler=# insert into z_test(t) values('');
INSERT 40606 1
ler=# select * from z_test;t
---0
(1 row)

ler=# \q
$
Connection to ler-freebie.iadfw.net closed.
$


on 7.3rc1:
$ psql
Welcome to psql 7.3rc1, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms      \h for help with SQL commands      \? for help on internal slash commands
    \g or terminate with semicolon to execute query      \q to quit
 

ler=# create table z_test(t int);
CREATE TABLE
ler=# insert into z_test(t) values('');
ERROR:  pg_atoi: zero-length string
ler=# \q
$


This drive phpgroupware nuts...

(their code needs help, but).

LER


-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749





Re: pg_atoi: zero length string

From
"Christopher Kings-Lynne"
Date:
> I know, it's late, and I assume this is intentional, but wanted to check:

<snip>

> This drive phpgroupware nuts...
>
> (their code needs help, but).

It is in the release notes.  I'm not sure why the behaviour was changed
(other than it really is bad behaviour).

Chris



Re: pg_atoi: zero length string

From
Larry Rosenman
Date:
Bug #1797 filed with the PHPgroupware side of savannah.

LER


--On Sunday, November 24, 2002 14:55:52 -0800 Christopher Kings-Lynne 
<chriskl@familyhealth.com.au> wrote:

>> I know, it's late, and I assume this is intentional, but wanted to check:
>
> <snip>
>
>> This drive phpgroupware nuts...
>>
>> (their code needs help, but).
>
> It is in the release notes.  I'm not sure why the behaviour was changed
> (other than it really is bad behaviour).
>
> Chris



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749





Re: pg_atoi: zero length string

From
Tom Lane
Date:
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> It is in the release notes.  I'm not sure why the behaviour was changed
> (other than it really is bad behaviour).

I think someone exhibited a case where COPY behavior was really
confusing because it was silently accepting an empty string for an int
field, instead of giving an error.  Since the behavior seemed obviously
bogus anyway, we were finally motivated to change it.
        regards, tom lane