Обсуждение: pg_atoi: zero-length string

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

pg_atoi: zero-length string

От
Dani Oderbolz
Дата:
Hi all,
I am sure this has been asked many times,
but I have not found anything in the archives...

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)?

Regards,
Dani




OT: Re: pg_atoi: zero-length string

От
Dani Oderbolz
Дата:
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




Re: pg_atoi: zero-length string

От
Larry Rosenman
Дата:
Upgrade phpgroupware.  This started with 7.3, and the PHPGroupware folks
fixed it based on a bug report I filed.

LER


--On Friday, November 07, 2003 12:57:47 +0100 Dani Oderbolz
<oderbolz@ecologic.de> wrote:

> Hi all,
> I am sure this has been asked many times,
> but I have not found anything in the archives...
>
> 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)?
>
> Regards,
> Dani
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>



--
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

Вложения

Oracle and PostgreSQL servers incompatibility

От
"Jouneau Luc"
Дата:
Hello everybody,

We plan to install on a same Solaris server an Oracle8i and a PostgreSQL
7.3.4 database.
During our impact tests, we encountered a situation where no more semaphore
was available for Oracle server (while we where bulk loading on postgreSQL
using copy statement. There was only one PG connection while there were many
on Oracle server).
I quote that our kernel configuration (semaphore and shared memory
parameters) had been previously correctly positionned as required in Oracle
and postgreSQL documentation.

I wanted to know if someone experienced this kind or other troubles in a
similar configuration (having Oracle and postgreSQL on the same Unix
server).

Thanks for your contribution,

L.Jouneau


Re: pg_atoi: zero-length string

От
Dani Oderbolz
Дата:
Larry Rosenman wrote:

> Upgrade phpgroupware.  This started with 7.3, and the PHPGroupware folks
> fixed it based on a bug report I filed.
>
> LER

Hmm,
my phpgroupware come right out of their CVS!
Which version was this fixed in?

Regards,
Dani


Re: Oracle and PostgreSQL servers incompatibility

От
Andrew Sullivan
Дата:
On Fri, Nov 14, 2003 at 12:07:40PM +0100, Jouneau Luc wrote:

> During our impact tests, we encountered a situation where no more semaphore
> was available for Oracle server (while we where bulk loading on postgreSQL
> using copy statement. There was only one PG connection while there were many
> on Oracle server).
> I quote that our kernel configuration (semaphore and shared memory
> parameters) had been previously correctly positionned as required in Oracle
> and postgreSQL documentation.

Sure, it might be correctly configured according to those docs, but
neither of them can know about other programs' semaphore use.  You
probably need more available semaphores from your kernel.

A

--
----
Andrew Sullivan                         204-4141 Yonge Street
Afilias Canada                        Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


Re: Oracle and PostgreSQL servers incompatibility

От
Tom Lane
Дата:
"Jouneau Luc" <Luc.Jouneau@jouy.inra.fr> writes:
> We plan to install on a same Solaris server an Oracle8i and a PostgreSQL
> 7.3.4 database.
> During our impact tests, we encountered a situation where no more semaphore
> was available for Oracle server (while we where bulk loading on postgreSQL
> using copy statement. There was only one PG connection while there were many
> on Oracle server).
> I quote that our kernel configuration (semaphore and shared memory
> parameters) had been previously correctly positionned as required in Oracle
> and postgreSQL documentation.

Obviously not.  I suspect you forgot to add up the semaphore
requirements of each package ...

            regards, tom lane

Re: Oracle and PostgreSQL servers incompatibility

От
Bruce Momjian
Дата:
Tom Lane wrote:
> "Jouneau Luc" <Luc.Jouneau@jouy.inra.fr> writes:
> > We plan to install on a same Solaris server an Oracle8i and a PostgreSQL
> > 7.3.4 database.
> > During our impact tests, we encountered a situation where no more semaphore
> > was available for Oracle server (while we where bulk loading on postgreSQL
> > using copy statement. There was only one PG connection while there were many
> > on Oracle server).
> > I quote that our kernel configuration (semaphore and shared memory
> > parameters) had been previously correctly positionned as required in Oracle
> > and postgreSQL documentation.
>
> Obviously not.  I suspect you forgot to add up the semaphore
> requirements of each package ...

Also, we grab all semaphores we will need for max connections at startup
so we don't fail under load so that might have surprised you.

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