X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 82510D1B54E for ; Fri, 7 Nov 2003 16:27:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 39194-10 for ; Fri, 7 Nov 2003 12:27:17 -0400 (AST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by svr1.postgresql.org (Postfix) with ESMTP id 69E0CD1B4E5 for ; Fri, 7 Nov 2003 12:27:16 -0400 (AST) Received: from [212.227.126.175] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1AI9S6-0006FM-00 for pgsql-admin@postgresql.org; Fri, 07 Nov 2003 17:27:14 +0100 Received: from [217.230.206.87] (helo=ecologic.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1AI9S6-0000FF-00 for pgsql-admin@postgresql.org; Fri, 07 Nov 2003 17:27:14 +0100 Message-ID: <3FABC7CF.9000609@ecologic.de> Date: Fri, 07 Nov 2003 17:26:55 +0100 From: Dani Oderbolz User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: OT: Re: pg_atoi: zero-length string References: <3FAB88BB.4040403@ecologic.de> In-Reply-To: <3FAB88BB.4040403@ecologic.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/125 X-Sequence-Number: 11113 Dani Oderbolz wrote: > .... > > I have an Application (www.phpgroupware), which submits > suboptimal Queries like > > SELECT * FROM phpgw_accounts WHERE account_id='' > > Now Postgresql responds like this: > > *PostgreSQL Error*: 1 (ERROR: pg_atoi: zero-length string ) > > Is there a workaround for this (eg. a Startup-Parameter that can be set)? > If anybody else has got troubles with this Application: I guess I have a Workaround with is not too hard. In the file $INSTALL_DIR/phpgwapi/inc/class.db_pgsql.inc.php change the function query, so that it looks like this: /* Postgres chokes on Queries like WHERE id='' */ $Query_String = str_replace("''","'0'",$Query_String); $this->Query_ID = @pg_Exec($this->Link_ID, $Query_String); In other words: right before phpgroupware does a call to pg_Exec, I replace any '' by '0' which causes Postgres to behave properly. Thanks to Oli and Jon Pastore for ginving me the crucial hints. Regards, Dani