0
votes

I get a record instead of a table when I

CREATE OR REPLACE FUNCTION public.func_obtener_calle(IN character varying)
  RETURNS TABLE(tip_via_in character varying, nom_via character varying, geom geometry) AS
$BODY$
  BEGIN
  RETURN QUERY
      SELECT *
      FROM tramo_vial

  WHERE (tramo_vial.nom_via like '%$1%' or tramo_vial.nom_via like upper('&$1%') or tramo_vial.nom_via like initcap('%$1%')); END; $BODY$  LANGUAGE plpgsql 

I allways get a record and I need a table to use after.

1

1 Answers

0
votes

In order to get the columns you require, you will need to specify it in your select statement, be it all of the columns or particular ones

e.g.

SELECT * FROM public.func_obtener_calle('text');

or

SELECT tip_via_in, nom_via, geom FROM public.func_obtener_calle('text');