Search Postgresql Archives

order by, within a plpgsql fx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please consider this plpgsql function:
= = = = = = = = = =
CREATE Or Replace FUNCTION fx_order_by ( )
RETURNS table( last_name text, first_name )
AS $eofx$
DECLARE
--
BEGIN

  Return Query
  select
    lname, fname
  from
    my_table
  order by
    lname  ASC
  ;

END;
$eofx$ LANGUAGE plpgsql;
= = = = = = = = = =

So, is this select statement's result set  guaranteed to be ordered as specified by the [order by] coded within the function body ?
= = = = = = = = = =
select last_name, first_name from fx_order_by() ;
= = = = = = = = = =

Or, must I code another [order by] to be sure ?
= = = = = = = = = =
select last_name, first_name from fx_order_by()   order by last_name ;
= = = = = = = = = =

Also, is the answer the same for a "sql" function ?

Thanks,
-dvs-





-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux