Pavel Stehule wrote:
CREATE FUNCTION getfoo(int) RETURNS foo AS $$ SELECT fooid, foosubid
FROM foo WHERE fooid = $1 LIMIT 1; $$ LANGUAGE SQL;
this return only one value, I need all the values that return the query
or
CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS $$ SELECT fooid,
foosubid FROM foo WHERE fooid = $1; $$ LANGUAGE SQL;
this create the same error:
ERROR: return type mismatch in function declared to return foo
DETAIL: Final SELECT returns too few columns.
CONTEXT: SQL function "getfoo
I try with:
CREATE FUNCTION getfoo (IN int, OUT int, OUT int) AS $$
SELECT fooid, foosubid FROM foo WHERE fooid = $1;
$$ LANGUAGE SQL;
but only one row returned...
Looking for other tips!
Thanks,
Michele
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match