Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AFE1164FCD6 for ; Tue, 19 Aug 2008 07:36:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 39662-09 for ; Tue, 19 Aug 2008 07:36:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gauss.credativ.com (gauss.credativ.com [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id F26DC64FCD0 for ; Tue, 19 Aug 2008 07:36:04 -0300 (ADT) Received: from feivel (exit.credativ.com [87.139.82.80]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id D4DE5214E69; Tue, 19 Aug 2008 12:35:40 +0200 (CEST) Received: by feivel (Postfix, from userid 1000) id 0CDBED6D36; Tue, 19 Aug 2008 12:31:18 +0200 (CEST) Date: Tue, 19 Aug 2008 12:31:18 +0200 From: Michael Meskes To: Bosco Rama Cc: pgsql-interfaces@postgresql.org Subject: Re: ecpg 'set' failure using host vars Message-ID: <20080819103118.GA23760@feivel.credativ.de> Mail-Followup-To: Bosco Rama , pgsql-interfaces@postgresql.org References: <48A64DE5.4000906@boscorama.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="FL5UXtIhxfXey3p5" Content-Disposition: inline In-Reply-To: <48A64DE5.4000906@boscorama.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/12 X-Sequence-Number: 6787 --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 15, 2008 at 08:47:49PM -0700, Bosco Rama wrote: > exec sql char *sm; > ... > sm = "myschema"; // This may not always be constant > ... > exec sql set search_path to :sm; Could you please try the attached patch and tell me whether it works for you? I will then check this in into 8.3 so that the next stable release works again as it should. Michael -- Michael Meskes Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org) ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL! --FL5UXtIhxfXey3p5 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ecpg_set.diff" --- pgsql-ecpg/preproc/preproc.y 2008-08-18 16:56:11.000000000 +0200 +++ pgsql/src/interfaces/ecpg/preproc/preproc.y 2008-08-19 12:29:28.000000000 +0200 @@ -1247,7 +1247,16 @@ ; var_value: opt_boolean { $$ = $1; } - | AllConst { $$ = $1; } + | AllConst { /* we have to check for a variable here because it has to be + replaced with its value on the client side */ + if ($1[1] == '$') + { + $$ = make_str("$0"); + free($1); + } + else + $$ = $1; + } | ColId { $$ = $1; } ; --FL5UXtIhxfXey3p5--