Re: CREATE FUNCTION

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jiri Nemec <konference(at)menea(dot)cz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE FUNCTION
Date: 2004-08-08 22:23:42
Message-ID: 22221.1092003822@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message gnari 2004-08-08 22:55:34 Re: CREATE FUNCTION
Previous Message Stephan Szabo 2004-08-08 22:17:04 Re: CREATE FUNCTION