ORDER BY in sql functions thows compile error

From: "K(dot) Ari Krupnikov" <ari(at)iln(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: ORDER BY in sql functions thows compile error
Date: 2000-07-06 06:01:05
Message-ID: 396420A0.B559573D@iln.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is it legal to have an ORDER BY clause in a SELECT statement inside an
SQL function?

This works fine:

CREATE FUNCTION getChildNodes (INT) RETURNS setof INT
AS '
SELECT child_node_id
FROM t_arch
WHERE parent_node_id = $1;
' LANGUAGE 'sql';

But this prints an error:

CREATE FUNCTION getChildNodes (INT) RETURNS setof INT
AS '
SELECT child_node_id
FROM t_arch
WHERE parent_node_id = $1
ORDER BY child_ord_no;
' LANGUAGE 'sql';

This is the error message:
function declared to return int4 returns multiple values in final
retrieve

I'm using Postges 7.0.2

--
K. Ari Krupnikov

DBDOM - bridging XML and relational databases
http://www.iter.co.il

Browse pgsql-general by date

  From Date Subject
Next Message Ferruccio Zamuner 2000-07-06 06:05:11 Partial indices
Previous Message jprem 2000-07-06 04:29:54 function for date difference ?