Hi!

I'm new on this list, my name is David Pradier, and i'm french.

I'm currently trying the new postgresql 7.3rc1, and i've noticed that if
i compared an integer to an empty string, i ran in an error.

Example :
=# select nom_comm from operation where id_operation = '';
ERROR:  pg_atoi: zero-length string

\d operation gives :
id_operation | integer | not null default nextval('"operation_type_id_operation_seq"'::text)

Is this a bug or a feature of the new 7.3 version ?
Is there a purpose ?

Thanks for your help.

Best regards,
David.
-- 
dpradier@apartia.fr

Thu, 21 Nov 2002 17:30:10 +0100
David Pradier <dpradier@apartia.fr>
Error when comparing an integer to an empty string.
On Thu, Nov 21, 2002 at 17:30:10 +0100,
  David Pradier <dpradier@apartia.fr> wrote:
> Hi!
> 
> I'm new on this list, my name is David Pradier, and i'm french.
> 
> I'm currently trying the new postgresql 7.3rc1, and i've noticed that if
> i compared an integer to an empty string, i ran in an error.
> 
> Is this a bug or a feature of the new 7.3 version ?
> Is there a purpose ?

What number do you expect '' to represent?

Probably you either want to use:
= '0'
or
is null
depending on what you are really trying to do.

Thu, 21 Nov 2002 11:07:55 -0600
Bruno Wolff III <bruno@wolff.to>
Re: Error when comparing an integer to an empty string.
On Thu, Nov 21, 2002 at 11:07:55AM -0600, Bruno Wolff III wrote:
> On Thu, Nov 21, 2002 at 17:30:10 +0100,
>   David Pradier <dpradier@apartia.fr> wrote:
> > Hi!
> > 
> > I'm new on this list, my name is David Pradier, and i'm french.
> > 
> > I'm currently trying the new postgresql 7.3rc1, and i've noticed that if
> > i compared an integer to an empty string, i ran in an error.
> > 
> > Is this a bug or a feature of the new 7.3 version ?
> > Is there a purpose ?
> 
> What number do you expect '' to represent?
> 
> Probably you either want to use:
> = '0'
> or
> is null
> depending on what you are really trying to do.

The point David was trying to make is: 

with 7.2:

	template1=# select 1 = '';
	 ?column? 
	----------
	 f
	(1 row)


with 7.3rc1:

	template1=# select 1 = '';
	ERROR:  pg_atoi: zero-length string


Is this change of behavior intentional?

-- 
 HIPPOLYTE: Trï¿½zï¿½ne m'obï¿½it. Les campagnes de Crï¿½te
            Offrent au fils de Phï¿½dre une riche retraite.
                                          (Phï¿½dre, J-B Racine, acte 2, scï¿½ne 2)

Thu, 21 Nov 2002 18:43:44 +0100
Louis-David Mitterrand <vindex@apartia.org>
Re: Error when comparing an integer to an empty string.
Louis-David Mitterrand <vindex@apartia.org> writes:
> with 7.2:
> 
> 	template1=# select 1 = '';
> 	 ?column? 
> 	----------
> 	 f
> 	(1 row)
> 
> 
> with 7.3rc1:
> 
> 	template1=# select 1 = '';
> 	ERROR:  pg_atoi: zero-length string
> 
> 
> Is this change of behavior intentional?

Yes.

I raised it as a possible point of backwards incompatibility at the
time the change was made, but the consensus was that this behavior was
worth getting rid of.

Cheers,

Neil

-- 
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC


21 Nov 2002 13:16:50 -0500
Neil Conway <neilc@samurai.com>
Re: Error when comparing an integer to an empty string.
Louis-David Mitterrand <vindex@apartia.org> writes:
> The point David was trying to make is: 
> with 7.2:
> 	template1=# select 1 = '';
> 	 ?column? 
> 	----------
> 	 f
> 	(1 row)

> with 7.3rc1:
> 	template1=# select 1 = '';
> 	ERROR:  pg_atoi: zero-length string

> Is this change of behavior intentional?

Yes.

			regards, tom lane

Thu, 21 Nov 2002 14:14:44 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Error when comparing an integer to an empty string. 
> > i compared an integer to an empty string, i ran in an error.
> > Is this a bug or a feature of the new 7.3 version ?
> > Is there a purpose ?
> 
> What number do you expect '' to represent?
> Probably you either want to use:
> = '0'
> or
> is null
> depending on what you are really trying to do.

It's because it comes from a perl building of the request.
Typically : '$youpee'
When $youpee is undef, it's no problem in 7.2, and the request returns
false.
Now it raises an error.
(Ok, i've understood it was on purpose ; i give these info only for the
background :-)

Best regards,
David

-- 
dpradier@apartia.fr

Fri, 22 Nov 2002 10:02:42 +0100
David Pradier <dpradier@apartia.fr>
Re: Error when comparing an integer to an empty string.