pglista=# CREATE OR REPLACE FUNCTION teste(int,float)
pglista-# RETURNS record AS '
pglista'# DECLARE
pglista'# numero ALIAS FOR $1;
pglista'# margem ALIAS FOR $2;
pglista'# retorno record;
pglista'# BEGIN
pglista'# retorno.ponto := numero;
pglista'# retorno.percentual := numero*margem;
pglista'# RETURN retorno;
pglista'# END;
pglista'# ' LANGUAGE plpgsql;
CREATE FUNCTION
pglista=# SELECT teste(100,0.1);
ERROR: record "retorno" is not assigned yet
DETAIL: The tuple structure of a not-yet-assigned record is indeterminate.
CONTEXT: PL/pgSQL function "teste" line 6 at assignment
pglista=# SELECT ponto,percentual FROM teste(100,0.1);
ERROR: a column definition list is required for functions returning
"record"
Someone knows if it possible to return a record without creating a type
for it, or how to make that definition list that the error message show me.