Re: [GENERAL] Changing between ORDER BY DESC and ORDER BY ASC

2008-08-18 Thread Sergey Konoplev
On Fri, Aug 15, 2008 at 9:35 PM, William Garrison [EMAIL PROTECTED]wrote: Is there an easy way to write one single query that can alternate between ASC and DESC orders? Ex: Take a look at this link http://www.mail-archive.com/pgsql-general@postgresql.org/msg111788.html -- Regards, Sergey

Re: [GENERAL] Changing between ORDER BY DESC and ORDER BY ASC

2008-08-18 Thread Dmitry Koterov
http://www.mail-archive.com/pgsql-general@postgresql.org/msg111788.htmlprobably won't match an index, because ASC or DESC ordering depends NOT on the table's data, but on the function parameter. Unfortunately the planner does not recognize the following case: CREATE TABLE public.prime ( num

Re: [GENERAL] Changing between ORDER BY DESC and ORDER BY ASC

2008-08-16 Thread Decibel!
On Aug 15, 2008, at 12:35 PM, William Garrison wrote: Is there an easy way to write one single query that can alternate between ASC and DESC orders? Ex: CREATE OR REPLACE FUNCTION GetSomeStuff(_start integer, _count integer, _sortDesc boolean) RETURNS SETOF text AS $BODY$

[GENERAL] Changing between ORDER BY DESC and ORDER BY ASC

2008-08-15 Thread William Garrison
Is there an easy way to write one single query that can alternate between ASC and DESC orders? Ex: CREATE OR REPLACE FUNCTION GetSomeStuff(_start integer, _count integer, _sortDesc boolean) RETURNS SETOF text AS $BODY$ SELECT something