X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9CB3E47580B for ; Mon, 14 Apr 2003 21:57:00 -0400 (EDT) Received: from capweb.com (capweb.com [161.58.201.59]) by postgresql.org (Postfix) with ESMTP id D5F00474E44 for ; Mon, 14 Apr 2003 21:56:59 -0400 (EDT) Received: from CWWNTLTD ([64.57.98.34]) by capweb.com (8.12.6p2) id h3F1vdoT020184 for ; Tue, 15 Apr 2003 01:57:40 GMT Message-ID: <000501c302f2$3a3997e0$1b01a8c0@jcaves.net> From: "Derek Hamilton" To: Subject: Stored Procedure Error Date: Mon, 14 Apr 2003 18:56:26 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Status: No, hits=-1.6 required=5.0 tests=BAYES_30 version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/224 X-Sequence-Number: 8379 Hello, I'm getting an error attempting to run the code below. The funny thing is, this code worked a few hours ago. The error is: WARNING: line 53 at return next ERROR: Set-valued function called in context that cannot accept a set I'm not really sure what else might be needed to debug this code. Any help is much appreciated. Here is the code: create or replace function testFunction(integer) returns setof namefilings as ' declare searchid ALIAS FOR $1; r names%rowtype; r2 namefilings%rowtype; select_text VARCHAR; get_nameid VARCHAR; BEGIN get_nameid := ''select nameid from names join searchvalues on (name = LOWER(value)) where searchid = '' || searchid; select_text := ''select b.* from names as a join namefilings as b on (a.nameid = b.nameid) where a.nameid IN (''; FOR r IN EXECUTE get_nameid LOOP select_text := select_text || r.nameid || '',''; end loop; select_text := RTRIM(select_text, '',''); select_text := select_text || '') limit 10''; FOR r2 IN EXECUTE select_text LOOP return next r2; END LOOP; return; END; ' language 'plpgsql'; Thanks, Derek