ecpg 'set' failure using host vars

Bosco Rama <[email protected]>
Newsgroups gmane.comp.db.postgresql.interfaces
Message-ID <[email protected]>
Hi,

I've been using the following set statement just fine under versions
prior to 8.3.3:

   exec sql char *sm;
   ...
   sm = "myschema";	// This may not always be constant
   ...
   exec sql set search_path to :sm;

However, a recent upgrade from 8.2.7 to 8.3.3 (on FC9) caused the
'set' statement to suddenly start throwing the dreaded error:

ERROR: syntax error at or near "$1" in line 13256

Running in debug output mode we are seeing the following:

[22245]: ecpg_execute line 13256: QUERY: set search_path to  $1  with 1 parameter on connection ecpgconn
[22245]: ecpg_execute line 13256: using PQexecParams
[22245]: free_params line 13256: parameter 1 = myschema
[22245]: ecpg_check_PQresult line 13256: Error: ERROR:  syntax error at or near "$1"
LINE 1: set search_path to  $1
                             ^

When the schema is replaced by a literal it works just fine, thusly:
    exec sql set search_path to myschema;

Did we miss something in the porting between versions?

Any help would be greatly appreciated.

Bosco.

-- 
Sent via pgsql-interfaces mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.