Обсуждение: Bug #840: Query with null string

Поиск
Список
Период
Сортировка

Bug #840: Query with null string

От
pgsql-bugs@postgresql.org
Дата:
Stéphane Bérubé (sirber@webernic.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Query with null string

Long Description
When I do a query (SELECT or INSERT) with null vars (see example) I get warnings from php:

Warning: pg_query() query failed: ERROR: pg_atoi: zero-length string in
/var/www/include/fr/sub/info/news/newdisplay.phpon line 27 

Warning: pg_fetch_object(): supplied argument is not a valid PostgreSQL result resource in
/var/www/include/fr/sub/info/news/newdisplay.phpon line 28 

because the WHERE was empty. This code worked fine on PostGreSQL 7.2.x. Now I'm on 7.3rel-4.

Any idea?

Thanks

Stéphane Bérubé

Sample Code
SELECT * FROM tbluser WHERE userid = ""


No file was uploaded with this report

Re: Bug #840: Query with null string

От
Stephan Szabo
Дата:
On Fri, 6 Dec 2002 pgsql-bugs@postgresql.org wrote:

> Sample Code
> SELECT * FROM tbluser WHERE userid = ""

I assume you mean '' rather than "".

0 length strings used to be interpreted as having
the value 0 when converted into an integer.  Now it
throws an error instead.  There was some discussion
at the time it happened and some more recently on
the mailing lists, you should be able to get more
info from the archives.