X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C7CA49FA48C for ; Thu, 18 May 2006 06:35:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 83332-06 for ; Thu, 18 May 2006 06:35:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from samwel.tk (bsamwel.xs4all.nl [82.92.179.183]) by postgresql.org (Postfix) with ESMTP id DCA669FA226 for ; Thu, 18 May 2006 06:35:19 -0300 (ADT) Received: from localhost ([127.0.0.1]) by samwel.tk with esmtp (Exim 4.62) (envelope-from ) id 1FgeuY-0001On-KT; Thu, 18 May 2006 11:35:14 +0200 Message-ID: <446C3F71.6060500@samwel.tk> Date: Thu, 18 May 2006 11:33:37 +0200 From: Bart Samwel User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: Hiroshi Inoue CC: pgsql-odbc@postgresql.org Subject: Re: Output parameters References: <446AE2CF.5070607@samwel.tk> <446B1B08.8020804@tpf.co.jp> <446B1C1F.6040301@samwel.tk> <446B1EB2.5040407@tpf.co.jp> <446B7211.20804@samwel.tk> <446BB29F.7070705@tpf.co.jp> In-Reply-To: <446BB29F.7070705@tpf.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: bart@samwel.tk X-SA-Exim-Scanned: No (on samwel.tk); SAEximRunCond expanded to false X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/40 X-Sequence-Number: 7711 Hiroshi Inoue wrote: > Bart Samwel wrote: >> Hiroshi Inoue wrote: >>> Bart Samwel wrote: >>>> Hiroshi Inoue wrote: >>>>> Bart Samwel wrote: >>>>>> Hi there, >>>>>> >>>>>> I've got a situation with the experimental enhanced branch driver >>>>>> (version 7.03.02.66), PostgreSQL 8.1 backend. I'm executing a >>>>>> query such as: >>>>>> >>>>>> SELECT myproc(?,?,?,?,?,?,?) >>>>>> >>>>>> where a number of the parameters are output parameters. I've bound >>>>>> buffers to the output parameters, but when I read the values, they >>>>>> contain garbage (uninitialized data, to be precise -- 0xcdcdcdcd). >>>>> >>>>> What kind of tool are you using and how do you execute the above >>>>> example concretely ? >>>> >>>> I'm using our own ODBC front end library, freshly written from spec. >>>> The same code works like a charm on Oracle to retrieve output >>>> parameters. I could figure out the exact sequence of calls if you >>>> want, there's quite a lot of wrapper code around it but It'd >>>> probably be possible. >>> >>> Could you send me the Mylog output ? >> >> Yes, it's attached. Please read on for some extra context information. >> :-) >> >> Anyway, it turns out that I misinterpreted the way PostgreSQL >> implements output parameters -- apparently, they are nothing but a >> convenient way to make PostgreSQL create a complex return type for a >> function. In PL/pgSQL, however, I can't specify the output parameters >> in the parameter list, while with the ODBC driver I can. > > Please use ODBC's standard syntax to execute functions or procedures. > > {[?=]call procedure-name[([?][,[?]]...)]} > > For example, please execute {CALL baz(?, ?)} in your case. Ah, that did the trick! I wasn't aware of this standard syntax, we've only recently started to use *real* ODBC instead of just using it as an easy way of getting the same SQL into different databases through one interface. I guess we'll have to start using more of these ODBC constructs. Thanks very much for your explanation! Cheers, Bart