pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Stored Procedure Error
3+ messages / 2 participants
[nested] [flat]

* Stored Procedure Error
@ 2003-04-15 01:56 Derek Hamilton <derek@capweb.com>
  2003-04-15 03:04 ` Re: Stored Procedure Error Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Derek Hamilton @ 2003-04-15 01:56 UTC (permalink / raw)
  To: pgsql-admin

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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Stored Procedure Error
  2003-04-15 01:56 Stored Procedure Error Derek Hamilton <derek@capweb.com>
@ 2003-04-15 03:04 ` Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Joe Conway @ 2003-04-15 03:04 UTC (permalink / raw)
  To: Derek Hamilton <derek@capweb.com>; +Cc: pgsql-admin

Derek Hamilton wrote:
> 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
> 

You haven't shown us the statement causing the error, but I'd bet you 
need to do:
   select * from testFunction(1);
instead of:
   select testFunction(1);

HTH,

Joe




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Stored Procedure Error
@ 2003-04-15 03:23 Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Joe Conway @ 2003-04-15 03:23 UTC (permalink / raw)
  To: Rich Burgi <ts-rrb@orem.verio.net>; +Cc: Derek Hamilton <derek@capweb.com>; pgsql-admin; majordomo@postgresql.org

Rich Burgi wrote:
> unsubscribe
> 
> GET ME OFF THIS DAMN LIST
> 

Sorry -- not much I can do for you, but see below:

>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-04-15 03:23 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-04-15 01:56 Stored Procedure Error Derek Hamilton <derek@capweb.com>
2003-04-15 03:04 ` Joe Conway <mail@joeconway.com>
2003-04-15 03:23 Re: Stored Procedure Error Joe Conway <mail@joeconway.com>

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