A negative scale value produces incorrect precision and scale values

63 views
Skip to first unread message

Thomas Maurer

unread,
Oct 29, 2019, 9:40:25 AM10/29/19
to H2 Database
If a number column has a negative scale value, e.g. NUMBER (5, -2), the precision and scale values are incorrect. They are set to 32767, regardless of the real values. Versions prior to 1.4.198 do not show this error. The attached example shows the error if the h2 version in pom.xml is set to > 1.4.197 .

h2-test.zip

Evgenij Ryazanov

unread,
Oct 29, 2019, 9:28:06 PM10/29/19
to H2 Database
Hello.

Scale should be unsigned according to the SQL Standard, so such definition is invalid.

On the other hand, H2 supports the negative scale in numeric data types and such support was broken by accident.

Thomas Maurer

unread,
Oct 31, 2019, 7:48:21 AM10/31/19
to H2 Database
Hi Evgenij

Oracle supports scale values from -84 to 127 https://www.oracletutorial.com/oracle-basics/oracle-number-data-type/. Do you intend to fix the problem to maintain oracle compatibility?

Evgenij Ryazanov

unread,
Oct 31, 2019, 8:16:09 AM10/31/19
to H2 Database
It was already fixed, you can build H2 from its current sources available on GitHub, if you wish.

Thomas Maurer

unread,
Oct 31, 2019, 2:00:58 PM10/31/19
to H2 Database
Thank you very much!
Reply all
Reply to author
Forward
0 new messages