RAISE concatination/variables in plpgsql
Henshall, Stuart - WCP <shenshall@westcountrypublications.co.uk>
From: "Henshall, Stuart - WCP" <SHenshall@westcountrypublications.co.uk>
To: "'pgsql-bugs@postgresql.org'" <pgsql-bugs@postgresql.org>
Date: 2001-04-19T16:43:06Z
Lists: pgsql-bugs
Attachments
- z (application/octet-stream)
SEVERITY:Minor Anoyance
In the plpgsql docs it has the following example:
RAISE NOTICE ''Id number '' || key || '' not found!'';
When I put a function round this statement it gives a compile error at the
|.
Also when fiddling if I put a variable first it complains about that
variable (eg key || '' val.....'')
Here is the script I ran:
DROP FUNCTION tstktxt(text);
CREATE FUNCTION tstktxt(text) RETURNS text AS '
DECLARE
key ALIAS FOR $1;
BEGIN
RAISE NOTICE ''Id number '' || key || '' not found!'';
RETURN key;
END;
' LANGUAGE 'plpgsql';
DROP FUNCTION tstkint(int4);
CREATE FUNCTION tstkint(int4) RETURNS int4 AS '
DECLARE
key ALIAS FOR $1;
BEGIN
RAISE NOTICE ''Id number '' || key || '' not found!'';
RETURN key;
END;
' LANGUAGE 'plpgsql';
SELECT tstktxt('Test');
SELECT tstkint(42);
This gave the following result:
DROP
CREATE
DROP
CREATE
psql:core/kytst.sql:21: NOTICE: plpgsql: ERROR during compile of tstktxt
near line 4
psql:core/kytst.sql:21: ERROR: parse error at or near "|"
psql:core/kytst.sql:22: NOTICE: plpgsql: ERROR during compile of tstkint
near line 4
psql:core/kytst.sql:22: ERROR: parse error at or near "|"
Is this a bug or documentation error?
I'm running on cygwin 1.1.7, cygipc 1.9.2, on win98SE
Here's the postmaster output (with -d2):
<<z>>