[ CC'd to "Jiri Nemec" <konference@menea.cz>]
"Jiri Nemec" <konference@menea.cz> said:
> Hello all, sorry about beginner question, but I'm sure function has
> correct structure, buw PostgreSQL reports error. (This function is
> only on approbation.)
>
> CREATE FUNCTION foo(int2)
> RETURNS TEXT
> AS 'DECLARE ret TEXT;
> begin
> SELECT INTO ret CAST(name AS text)
> FROM shop_goods
> WHERE id = $1;
> return ret;
> end;'
> language 'sql';
should this not be language 'plpgsql' ?
or
CREATE FUNCTION foo(int2)
RETURNS TEXT AS '
SELECT CAST(name AS text)
FROM shop_goods
WHERE id = $1;
' language 'sql';
mind you, i could be wrong.
gnari