Re: ERROR: $1 is declared CONSTANT in plpgsql

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Hans Plum <plum(at)giub(dot)uni-bonn(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: ERROR: $1 is declared CONSTANT in plpgsql
Date: 2002-05-07 14:50:42
Message-ID: 1020783042.13683.2702.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, 2002-05-07 at 12:18, Hans Plum wrote:
> Hello folks,
> I wrote my first plpgsql-functions for PostgreSQL 7.1.3. I try to
> convert Ascii-Strings in HTML-conform Strings (Converting 'quator' ->
> '&Auml;quator') ... Now I get a error message like this:
>
> NOTICE: plpgsql: ERROR during compile of f_ascii2html near line 7
> ERROR: $1 is declared CONSTANT
>
> For me $1, or better InpAscii is not CONSTANT ... I cannot find the
> mistake ... Can anybody help out?
...
> CREATE FUNCTION f_ascii2html(TEXT)
> RETURNS TEXT
> AS '
> DECLARE
> InpAscii ALIAS FOR $1;
...
> BEGIN
> InpAscii := $1;

You don't need to (cannot) assign to InpAscii. Just miss out that last
line. You have already done what you want in the declaration, so that
last line amounts to "$1 := $1".

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

"Dearly beloved, avenge not yourselves, but rather give
place unto wrath. For it is written, Vengeance is
mine; I will repay, saith the Lord. Therefore if thine
enemy hunger, feed him; if he thirst, give him drink;
for in so doing thou shalt heap coals of fire on his
head. Be not overcome of evil, but overcome evil with
good." Romans 12:19-21

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Henshall, Stuart - WCP 2002-05-07 16:13:26 Re: ERROR: $1 is declared CONSTANT in plpgsql
Previous Message Tom Lane 2002-05-07 14:40:31 Re: ERROR: $1 is declared CONSTANT in plpgsql