[Pljava-dev] Possible bug, when updating BigDecimal from trigger/function

From: books at ejurka(dot)com (Kris Jurka)
To:
Subject: [Pljava-dev] Possible bug, when updating BigDecimal from trigger/function
Date: 2008-06-10 03:47:51
Message-ID: 484DF967.1090001@ejurka.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Petr Mich?lek wrote:
>
> When PL/Java trigger/function is updating BigDecimal, scale of new
> BigDecimal value is not checked. Because of this, is possible store in
> database numeric value with greater precision than is in column definition.
>
> Please can anybody confirm this behavior and is possible to fix this.
>

I haven't tested it myself, but it certainly looks like something that
would happen when updating TriggerData. Under the hood we're using
SPI_modifytuple which is apparently too low level for pg to do the
precision/scale checks and it expects us to perform them before calling
this method. For pljava, the conversion to backend type is going
through a generic type conversion routine which doesn't have access to
typmod information. It seems like we'd have to modify the whole
coerceObject interface to support passing around typmod. I'm not sure
how hard that would be to do.

Kris Jurka

In response to

Browse pljava-dev by date

  From Date Subject
Next Message Terence Ng 2008-06-10 15:58:07 [Pljava-dev] How to compile pljava in Solaris 10 5/08?
Previous Message Petr Michálek 2008-06-08 20:06:56 [Pljava-dev] Possible bug, when updating BigDecimal from trigger/function