Re: ORDER BY with plpgsql parameter - Mailing list pgsql-general

From Stephan Szabo
Subject Re: ORDER BY with plpgsql parameter
Date
Msg-id 20040602072213.U50862@megazone.bigpanda.com
Whole thread Raw
In response to Re: ORDER BY with plpgsql parameter  (Thomas Schoen <t.schoen@vitrado.de>)
Responses Re: ORDER BY with plpgsql parameter  (Thomas Schoen <t.schoen@vitrado.de>)
List pgsql-general
On Wed, 2 Jun 2004, Thomas Schoen wrote:

> > You need to use the FOR-IN-EXECUTE style of query. That way
> > you can use any string you want (including text passed in as
> > a parameter) to build the query inside the function ...
>
> that is what i want to avoid. (i wrote that in my first mail)
> My question was about why it is not possible to do it like this:
> ....ORDER BY $1

One problem is that doing the above as column name would make the $1 have
a different meaning from its use in other places like where clauses (where
it acts like a bound parameter).

Apart from the quoting issue, I'm also not sure how it would be any
different from for-in-execute in any case.


pgsql-general by date:

Previous
From: Greg Stark
Date:
Subject: Re: Running Totals and other stuff....
Next
From: Bill Moran
Date:
Subject: Re: Creating a session variable in Postgres