X-Original-To: pgsql-odbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E480B9FB3EB for ; Fri, 18 Aug 2006 15:29:36 -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 50226-02-6 for ; Fri, 18 Aug 2006 15:25:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id EE7F39FB3F6 for ; Fri, 18 Aug 2006 15:19:09 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from localhost.local (mail.careerjunction.co.za [196.41.180.17]) by svr4.postgresql.org (Postfix) with ESMTP id 791EC5AF043 for ; Fri, 18 Aug 2006 18:19:08 +0000 (GMT) Received: from CJRODNEY ([172.19.44.51]) by localhost.local (8.12.8/8.12.8) with ESMTP id k7IIJ8Th027463 for ; Fri, 18 Aug 2006 20:19:11 +0200 Reply-To: From: "Rodney Franks" To: Subject: Parameters.Refresh and RETURN setof TEXT Date: Fri, 18 Aug 2006 20:22:20 +0200 Organization: CareerJunction Message-ID: <005001c6c2f3$3e9ff670$332c13ac@careerjunction.local> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 thread-index: AcbC8z45ZDjtLQHPQquL5SlJPOVIzA== X-Virus-Scanned: ClamAV 0.88.3/1684/Fri Aug 18 18:09:44 2006 on cjjhbmail X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/64 X-Sequence-Number: 8028 Hi all, If I have a simple set returning function like 'aafunc1' ---------------------------------------------------------------- CREATE OR REPLACE FUNCTION "public"."aafunc1" (v_acc integer) RETURNS SETOF text AS $body$ BEGIN RETURN NEXT 'Arbitary_string of unlimitedLength.'; RETURN NEXT 'Arbitary_string of unlimitedLength222222.'; RETURN; END; $body$ LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; ---------------------------------------------------------------- Which I then call using vbsrcipt, ADO & the postgresql odbc driver like this:- ---------------------------------------------------------------- Set oCmd = CreateObject("ADODB.Command") With oCmd .ActiveConnection = oConnection .CommandType = 4 'adCmdStoredProc .CommandText = "public.aafunc1" .Parameters.Refresh() .Parameters("v_acc").Value = 1 .Execute End With wscript.echo oCmd.Parameters(0) ---------------------------------------------------------------- Why does it not work, it returns an error ... errmsg='ERROR: set-valued function called in context that cannot accept a set' When looking at the odbc log [3352]Exec_with_parameters_resolved: copying statement params: trans_status=1, len=30, stmt='{ ? = call public.aafunc1(?) }' [3352]ResolveOneParam: from(fcType)=-16, to(fSqlType)=4 [3352] stmt_with_params = 'SELECT public.aafunc1(1) ' [3352] it's NOT a select statement: stmt=1c62230 [3352]send_query(): conn=1c639b0, query='SELECT public.aafunc1(1) ' [3352]send_query: done sending query How come it is not picking up that this function returns a SETOF something, and then changing the Sql statement to "'SELECT * from public.aafunc1(1) '" I am using windows XP and postgres ODBC driver 8.02.00.02, and the postgres dbase 8.1.4 is running on linux. I would appreciate some help/thoughts on this issue Thanks... Rodney Franks