RAISE concatination/variables in plpgsql

From: "Henshall, Stuart - WCP" <SHenshall(at)westcountrypublications(dot)co(dot)uk>
To: "'pgsql-bugs(at)postgresql(dot)org'" <pgsql-bugs(at)postgresql(dot)org>
Subject: RAISE concatination/variables in plpgsql
Date: 2001-04-19 16:43:06
Message-ID: E2870D8CE1CCD311BAF50008C71EDE8E01CA7F0B@MAIL_EXCHANGE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Attachment Content-Type Size
z application/octet-stream 5.0 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Lamar Owen 2001-04-19 17:33:51 Re: startup scripts don't function properly
Previous Message Peter Eisentraut 2001-04-19 16:10:21 Re: BUG??, fault in POSTMASTER when using GMAKE