03.02.2018 14:05, Mark Rotteveel wrote:
1. When sending values from client to server, will Firebird reject values with the wrong
scale for subtypes 1 and 2, or round them to the correct scale?
As an example, will sending 12.345 (12345e-3) for a DECIMAL(34,2) be rejected with an
incorrect scale error, or will it be rounded appropriately (to 12.34 (1234e-2) assuming
half even rounding)? Similar sending 123 (123e0) will that throw an error, or 'round' to
123.00 (12300e-2)?
If the second option, errors would only be raised if this would produce an overflow (eg
sending 123e34 can never be made to fit a decimal(34,2))
If we follow the SQL rules for store and retrieval assignment (9.1 and 9.2), then we
should allow values with a different scale, and round appropriately.
It is done currently for double precision and I see no reasons to break this tradition
and standard.
But would this lead to differences in behavior compared to DECIMAL and NUMERIC with
precision <= 18? I'm not sure if it is currently possible to send 12345 with sqlscale = -3
and have it converted correctly to a scale 2, or not. I can experiment with Jaybird to
check, but if someone knows that would save me some time (as Jaybird itself already rounds
before sending, and circumventing that is a bit of a pain).
AFAIK, it is possible and server performs coercion from user-provided type into
server-required type.
--
WBR, SD.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel