Re: function retuning refcursor, order by ignored? - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: function retuning refcursor, order by ignored?
Date
Msg-id 20070530185303.GK7128@alvh.no-ip.org
Whole thread Raw
In response to Re: function retuning refcursor, order by ignored?  (novnov <novnovice@gmail.com>)
Responses Re: function retuning refcursor, order by ignored?
List pgsql-general
novnov escribió:
>
> While a hard coded order by clause works; passing the order by as a param is
> ignored as I've implemented below.  The order by value is being passed as
> expected (tested by outputing the value in a column).

It doesn't because the value is expanded as a constant, therefore all
rows have the same value and the sort is a no-op.  Try using EXECUTE
(although I admit I don't know if you are able to do an OPEN CURSOR with
EXECUTE)


--
Alvaro Herrera                 http://www.amazon.com/gp/registry/CTMLCN8V17R4
Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green
stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'.
After collecting 500 such letters, he mused, a university somewhere in
Arizona would probably grant him a degree.              (Don Knuth)

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: function retuning refcursor, order by ignored?
Next
From: Jeff Davis
Date:
Subject: Re: Uhm, so, yeah, speaking of /.