Re: function retuning refcursor, order by ignored?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
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:47:39
Message-ID: 20070530184739.GD18387@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 30, 2007 at 11:40:15AM -0700, novnov wrote:
>
> 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). I've called like so:

What you're doing is equivalent to ORDER BY 'constant' which is totally
meaningless. If you want to control the column name dynamically, you
need to build the query dynamically, with EXECUTE for example.

> ORDER BY "pstr_orderby";

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-05-30 18:53:03 Re: function retuning refcursor, order by ignored?
Previous Message Joshua D. Drake 2007-05-30 18:41:00 Re: Uhm, so, yeah, speaking of /.