Re: function retuning refcursor, order by ignored?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: novnov <novnovice(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: function retuning refcursor, order by ignored?
Date: 2007-05-30 18:53:03
Message-ID: 20070530185303.GK7128@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2007-05-30 18:55:49 Re: Uhm, so, yeah, speaking of /.
Previous Message Martijn van Oosterhout 2007-05-30 18:47:39 Re: function retuning refcursor, order by ignored?