Re: CREATE FUNCTION - Mailing list pgsql-general

From Tom Lane
Subject Re: CREATE FUNCTION
Date
Msg-id 22221.1092003822@sss.pgh.pa.us
Whole thread Raw
In response to CREATE FUNCTION  (Jiri Nemec <konference@menea.cz>)
List pgsql-general
Jiri Nemec <konference@menea.cz> writes:
> 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';

This is a plpgsql function, not a sql function --- you are selecting
the wrong language.

            regards, tom lane

pgsql-general by date:

Previous
From: Kris Jurka
Date:
Subject: Re: pg jdbc driver
Next
From: lec
Date:
Subject: Losing records when server hang