CREATE FUNCTION - Mailing list pgsql-general

From Jiri Nemec
Subject CREATE FUNCTION
Date
Msg-id 1612792305.20040808232749@menea.cz
Whole thread Raw
Responses Re: CREATE FUNCTION  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: CREATE FUNCTION  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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';

PostgreSQL still returns:

ERROR:  syntax error at or near "TEXT" at character 13

PostgreSQL version:

jirka@debian:/root$ /usr/local/postgresql/bin/postmaster --version
postmaster (PostgreSQL) 7.4.2

I have tried function from PostgreSQL book but with same results.
Thank you for replies.

--
Jiri Nemec
www.menea.cz - web solutions


pgsql-general by date:

Previous
From: Pierre-Frédéric Caillaud
Date:
Subject: Re: Out of swap space & memory
Next
From: Robert Fitzpatrick
Date:
Subject: tracking down foreign key constraint violation error