Re: CREATE FUNCTION

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Jiri Nemec <konference(at)menea(dot)cz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE FUNCTION
Date: 2004-08-08 22:17:04
Message-ID: 20040808151513.X7480@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sun, 8 Aug 2004, Jiri Nemec wrote:

> 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';

I think you meant language 'plpgsql' rather than 'sql' since the above
looks like the former.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-08-08 22:23:42 Re: CREATE FUNCTION
Previous Message Robert Fitzpatrick 2004-08-08 22:08:49 tracking down foreign key constraint violation error