From: | Alex du Plessis <alexdup(dot)main(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Strange behavior of plpgsql. |
Date: | 2009-11-04 15:05:49 |
Message-ID: | f63442d70911040705t53691bf4of220732e0bd9e33c@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hello list
I just noticed a strange quirk of plpgsql. It gave me an error when trying
to access a member of a complex field in NEW. Error reported was: "ERROR:
NEW used in query that is not in a rule".
However, it seems that plsql rather has a problem with the double dot i.e.
NEW.amount.direction and could not parse that (or did not have any knowledge
of the complex type).
I found a workaround by first declaring a local variable to the complex type
DECLARE amnt tlx_actamount;
and then assigning the complex field to this variable. It seems plpgsql is
quite happy to accept such a consstruct.
As an example :
plpgsql will not accept
NEW.amount.direction ..and give the error listed above
It will however be happy with:
DECLARE amnt tlx_amount;
...
amnt:=NEW.amount;
Hope this sheds some light for a guru
Regards
--
Alex du Plessis
From | Date | Subject | |
---|---|---|---|
Next Message | CBoone | 2009-11-04 15:45:06 | Postgre 8.1.11 and Windows 7 (64-bit) |
Previous Message | Michael Wood | 2009-11-04 09:17:51 | Re: Install problems for postgresql-8.4.1 |