Invalid statement name (null) in line ## - what am I doing wrong ? - Mailing list pgsql-general

From leif@crysberg.dk
Subject Invalid statement name (null) in line ## - what am I doing wrong ?
Date
Msg-id 25028798.72981245373715194.JavaMail.root@quick
Whole thread Raw
Responses Re: Invalid statement name (null) in line ## - what am I doing wrong ?
Re: Invalid statement name (null) in line ## - what am I doing wrong ?
List pgsql-general
Hi,

   I have a problem when upgrading from 8.2.4 to 8.3/8.4 using ecpg with a prepare statement:

EXEC SQL PREPARE execquery FROM :stmt; line = __LINE__;
EXEC SQL AT :_thisDbConn DECLARE execcurs CURSOR FOR execquery; line = __LINE__;
EXEC SQL AT :_thisDbConn OPEN execcurs; line = __LINE__;
EXEC SQL ALLOCATE DESCRIPTOR execdesc; line = __LINE__;

   I get an "SQL error: invalid statement name "(null)" on line ##" (3rd line above) on the OPEN cursor statement. I
havebeen digging a little in the ecpg output and noticed that the format of the ECPGprepare() function call has changed
between8.2.4 and 8.3++. Also the ecpg library has changed version libecpg.so.5 -> libecpg.so.6. 

   I am compiling my program on an (older) system with 8.2.4 installed and I need have my program running on a
productionsystem running 8.3.5 or higher. This seems to work fine, but for other reasons I wanted to upgrade my
"compilesystem" with 8.3.5 and this started to give me the error mentioned above. 

   An ldd on the program gives:

libecpg.so.6 => /usr/local/Packages/pgsql-8.3.5/lib/libecpg.so.6 (0xb7ed8000)
libpq.so.5 => /usr/local/Packages/pgsql-8.3.5/lib/libpq.so.5 (0xb7ebc000)

 which looks to be ok. (The 8.2.4 compiled program was using libecpg.so.5.)

   It seems to me that somehow the prepare statement (first line above) is compiled into a ECPGprepare() call with 5
parameters,but using a library function with only 3 parameters, even though it points to the libecpg.so.6, which
includescode having the 5 parameter ECPGprepare() function. 

   All PostgreSQL systems are natively installed from source on the various systems, i.e. compiled individually on each
system.All my systems are running Linux, but with different versions of Linux. 

   I have also tried the very newest version 8.4rc1, but with same result, the error above.

  Please help,

 Leif

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: postgresql-8.3.7 unexpected connection closures
Next
From: Andrew Maclean
Date:
Subject: Re: postgresql-8.3.7 unexpected connection closures