order by, within a plpgsql fx - Mailing list pgsql-general

From
Subject order by, within a plpgsql fx
Date
Msg-id F3CBFBA88397EA498B22A05FFA9EC49D5B9F2E51@MX22A.corp.emc.com
Whole thread Raw
Responses Re: order by, within a plpgsql fx
List pgsql-general
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
functionbody ? 
= = = = = = = = = =
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-





pgsql-general by date:

Previous
From: Torsten Zuehlsdorff
Date:
Subject: Re: How to convert HEX to ASCII?
Next
From: Tom Lane
Date:
Subject: Re: order by, within a plpgsql fx