ERROR: unexpected SELECT query in exec_stmt_execsql()

From: "Branden R(dot) Williams" <brw(at)kickinit(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: ERROR: unexpected SELECT query in exec_stmt_execsql()
Date: 2000-08-15 14:20:50
Message-ID: Pine.LNX.4.20.0008150857210.31566-100000@altair.kickinit.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hi. I am attempting to create a function to do some selects and return
some information. Pretty straight forward. No matter what I do, I always
get this error. Here is my stored function and how I am calling it...

create function sp_list_categories(int4) returns varchar as '
DECLARE
postid ALIAS FOR $1;
parentid int4;
BEGIN

SELECT * FROM category WHERE id = postid;
parentid := SELECT parent FROM category WHERE id = postid;

IF parentid ISNULL THEN
RETURN
ELSE
SELECT sp_list_categories(parentid);
RETURN name;
END IF;

END;
' LANGUAGE 'plpgsql';

jimmydbase=# select sp_list_categories(20);
ERROR: unexpected SELECT query in exec_stmt_execsql()

Any and all help would be appreciated!

Branden.

Browse pgsql-general by date

  From Date Subject
Next Message jeff seaman 2000-08-15 14:27:47 passwords and pg_dump
Previous Message Adrian Phillips 2000-08-15 13:49:27 Re: Great Bridge benchmark results for Postgres, 4 others

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Swan 2000-08-15 15:37:50 Re: 8K Limit, whats the best strategy?
Previous Message Volker Krebs 2000-08-15 13:24:59 Re: Language dependent fields