CREATE FUNCTION

From: Jiri Nemec <konference(at)menea(dot)cz>
To: pgsql-general(at)postgresql(dot)org
Subject: CREATE FUNCTION
Date: 2004-08-08 21:27:49
Message-ID: 1612792305.20040808232749@menea.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)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

Responses

Browse pgsql-general by date

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