ecpg 'set' failure using host vars

From: Bosco Rama <postgres(at)boscorama(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: ecpg 'set' failure using host vars
Date: 2008-08-16 03:47:49
Message-ID: 48A64DE5.4000906@boscorama.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-08-16 03:49:37 Re: pgsql: Make the pg_stat_activity view call a SRF
Previous Message Bruce Momjian 2008-08-16 03:43:58 Re: Explain XML patch submitted

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Meskes 2008-08-16 08:31:56 Re: ecpg 'set' failure using host vars
Previous Message Александр Чешев 2008-08-14 08:31:15 PostgreSQL arrays and DBD