Re: ERROR: $1 is declared CONSTANT in plpgsql - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: ERROR: $1 is declared CONSTANT in plpgsql
Date
Msg-id 1020783042.13683.2702.camel@linda
Whole thread Raw
In response to ERROR: $1 is declared CONSTANT in plpgsql  (Hans Plum <plum@giub.uni-bonn.de>)
List 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' ->
> 'Ä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.Elphick@lfix.co.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

Attachment

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: ERROR: $1 is declared CONSTANT in plpgsql
Next
From: "Henshall, Stuart - WCP"
Date:
Subject: Re: ERROR: $1 is declared CONSTANT in plpgsql