Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 77A7C6340AD for ; Fri, 17 Apr 2009 02:53:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 86266-10 for ; Fri, 17 Apr 2009 02:52:47 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.232]) by mail.postgresql.org (Postfix) with ESMTP id 1875E62DBF1 for ; Fri, 17 Apr 2009 02:52:45 -0300 (ADT) Received: by rv-out-0506.google.com with SMTP id l9so714675rvb.43 for ; Thu, 16 Apr 2009 22:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=t9LQ4lzz3RalA0Vtmc20FgzhEr66tAXS7xYHC7r3ATk=; b=oDTJ8ft+RXFB3GO31MMQX5TfAHVPAHXLAI/paXiRWlwL4KzGeBwyepVPR0aFjzl5gW /DhQJNdC3HpqwRclGEFsfQAbckTLdbPQ/F/IhhjijlbtPAZ3KifA+oqWpHWm9xWQGP6G OXASZIRBIqWrUlsZq/W2vl9EB9pghdmYJdDds= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=IbbHn6RPdtKV4DTFWdilZu9dvES/9sJMaCR1xK0TO47JFaJ3wY6imqq3MVKGcySD6S 0LKpffG3qULjlJEuGqyDEJ1w8KW9esEdPeUgevHbRobTqmR8c7dXu8DuxijV3PlYKpcn ywJkeWp5TFOmkqjVSb7RDHM56DOwo/LQ1U9z0= MIME-Version: 1.0 Received: by 10.142.185.21 with SMTP id i21mr3158477wff.311.1239947564497; Thu, 16 Apr 2009 22:52:44 -0700 (PDT) In-Reply-To: <16591.1239890835@sss.pgh.pa.us> References: <27f31620904160102j7668c947ta435601dd8751c6e@mail.gmail.com> <16591.1239890835@sss.pgh.pa.us> Date: Fri, 17 Apr 2009 14:52:44 +0900 Message-ID: <27f31620904162252t650c5205g1305a3cdbce15c1@mail.gmail.com> Subject: Re: Bound parameter is not substituted From: ning To: Tom Lane Cc: pgsql-odbc@postgresql.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 200904/18 X-Sequence-Number: 9837 Thank you very much for your reply. Now I understand the cause of the error, but I seems funciton body cannot be constructed dynamically. I tried: ----------- ss << "create or replace function plpgsql_setDocAttrs() returns void as ' " "declare " "pid integer; " "begin " "pid :=3D ' " " || ? || " "'; " "end;" "' language plpgsql volatile;" ---------- When I bind a variable, with value 10, to ?, the string after substitution = is ---------- create or replace function plpgsql_setDocAttrs() returns void as 'declare pid integer;begin pid :=3D ' || 10 || '; end;' language plpgsql volatile; ---------- I got the following error: ERROR: syntax error at or near "||" String concatenation operator "||" is not allowed in "create function" statement, which breaks syntax. Is there any way to force string concatenation before function definition? So that the function body is firstly concatenated to --------- 'declare pid integer;begin pid :=3D 10; end;' -------- Then "create function" statement is executed as ------- create or replace function plpgsql_setDocAttrs() returns void as ' declare pid integer;begin pid :=3D 10; end;' language plpgsql volatile; ------ Any suggestion or idea is appreciated. Best regards. ning On Thu, Apr 16, 2009 at 11:07 PM, Tom Lane wrote: > ning writes: >> I am trying to create a stored function through ODBC connection, >> But the parameter marker inside the function is not substituted. > > You've written a question mark inside a string literal. =C2=A0It would be > a bug for the software to consider that to be a parameter marker. > It's just a question mark. > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0regards, tom lane >