Re: CREATE FUNCTION

From: "gnari" <gnari(at)simnet(dot)is>
To: <pgsql-general(at)postgresql(dot)org>
Cc: <konference(at)menea(dot)cz>
Subject: Re: CREATE FUNCTION
Date: 2004-08-08 22:55:34
Message-ID: 001801c47d9a$d02aadb0$0100000a@wp2000
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

[ CC'd to "Jiri Nemec" <konference(at)menea(dot)cz>]

"Jiri Nemec" <konference(at)menea(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kris Jurka 2004-08-09 00:14:53 Re: pg jdbc driver
Previous Message Tom Lane 2004-08-08 22:23:42 Re: CREATE FUNCTION