pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Derek Hamilton <derek@capweb.com>
To: pgsql-admin@postgresql.org
Subject: Stored Procedure Error
Date: Mon, 14 Apr 2003 18:56:26 -0700
Message-ID: <000501c302f2$3a3997e0$1b01a8c0@jcaves.net> (raw)

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




view thread (3+ messages)  latest in thread

Message-ID: <000501c302f2$3a3997e0$1b01a8c0@jcaves.net>
Permalink:  ../000501c302f2$3a3997e0$1b01a8c0@jcaves.net/
Also on:    postgresql.org/message-id/000501c302f2$3a3997e0$1b01a8c0@jcaves.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: derek@capweb.com
  Subject: Re: Stored Procedure Error
  In-Reply-To: <000501c302f2$3a3997e0$1b01a8c0@jcaves.net>
  References: <000501c302f2$3a3997e0$1b01a8c0@jcaves.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox