El código está bien, estas sobrecargando esa función con una versión
sin parámetros. La siguiente query te va a retornar 2 rows:

so=# select proargnames, prosrc from pg_proc where proname = 'ufp_lista_ccosto';
        proargnames        |
 prosrc
---------------------------+----------------------------------------------------------------------------------------------
 {"",t_elem,t_des1,t_area} |
                                                  +
                           | declare
                                                  +
                           | x_empr alias for $1;
                                                  +
                           | begin
                                                  +
                           | return query SELECT language::varchar,
'text'::varchar, 'text2'::varchar FROM  search ccosto+
                           |   where ccosto.language=x_empr::regconfig
                                                  +
                           | ORDER BY ccosto.language;
                                                  +
                           | end;
                                                  +
                           |
(1 row)

2016-10-30 21:20 GMT-03:00 Felipe Araoz Ramos <far...@gmail.com>:
> Buena noche amigos
>
> He hecho una funcion simple que me lista una tabla filtrando por un campo,
> sin embargo cuando ejecuto la funion sin paramtros tambien me la muestra,
> deberia ser asi?
>
>
> CREATE OR REPLACE FUNCTION ufp_lista_ccosto (IN character)
> RETURNS TABLE(t_elem character varying, t_des1 character varying, t_area
> character varying) AS
> $BODY$
> declare
> x_empr alias for $1;
> begin
> return query
> SELECT ccosto.t_elem,ccosto.t_des1,ccosto.t_area
> FROM  fpcost ccosto
>   where ccosto.t_empr=x_empr
> ORDER BY ccosto.t_elem;
> end;
> $BODY$
>   LANGUAGE plpgsql VOLATILE
>   COST 100
>   ROWS 1000;
>
> cuando ejecuto
> SELECT * from ufp_lista_ccosto('01') me mestra filtrando
>
> SELECT * from ufp_lista_ccosto(), me mestra todo
>
>
>
> Felipe Araoz Ramos
> RPM #941990605 / 941990605
> Lima-Perù
>



-- 
--
Emanuel Calvo
Sr. Technical Services at Percona
Team Building at Ayres.io

-
Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda@postgresql.org)
Para cambiar tu suscripci�n:
http://www.postgresql.org/mailpref/pgsql-es-ayuda

Responder a