ORDER BY in sql functions thows compile error - Mailing list pgsql-general

From K. Ari Krupnikov
Subject ORDER BY in sql functions thows compile error
Date
Msg-id 396420A0.B559573D@iln.net
Whole thread Raw
List 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

pgsql-general by date:

Previous
From: jprem
Date:
Subject: function for date difference ?
Next
From: Ferruccio Zamuner
Date:
Subject: Partial indices