Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-interfaces

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.



pgsql-hackers by date

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

pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group