Re: [GENERAL] Order by parameter inside pgsql function ignored

2009-06-02 Thread A. Kretschmer
In response to Anton Marchenkov : > Hi! > > I'm trying to use the order by parameter inside a function, but it is > ignored. Any ideas why? And how can I sort by external parameters inside > pgsql function? You an use dynamic SQL with EXECUTE, for instance: create or replace function my_order

Re: [GENERAL] Order by parameter inside pgsql function ignored

2009-06-02 Thread Leif B. Kristensen
On Tuesday 2. June 2009, Anton Marchenkov wrote: >CREATE OR REPLACE FUNCTION "public"."test_order_by" (sort_key varchar) >RETURNS SETOF "customers"."customers_with_mark_deleted" AS >$body$ >DECLARE > rec RECORD; >BEGIN > FOR rec IN SELECT * FROM customers.customers_with_mark_deleted c >

Re: [GENERAL] Order by parameter inside pgsql function ignored

2009-06-02 Thread Leif B. Kristensen
On Tuesday 2. June 2009, Anton Marchenkov wrote: >Hi! > >I'm trying to use the order by parameter inside a function, but it is >ignored. Any ideas why? And how can I sort by external parameters > inside pgsql function? What's the problem with SELECT * FROM foo(myvar) ORDER BY sort_key ASC ? If

[GENERAL] Order by parameter inside pgsql function ignored

2009-06-02 Thread Anton Marchenkov
Hi! I'm trying to use the order by parameter inside a function, but it is ignored. Any ideas why? And how can I sort by external parameters inside pgsql function? CREATE OR REPLACE FUNCTION "public"."test_order_by" (sort_key varchar) RETURNS SETOF "customers"."customers_with_mark_deleted" AS