Menu

#903 SUM incorrectly adds packed decimal fields

unclassified
open
nobody
5 - default
2023-08-18
2023-08-16
Tom Donovan
No

Report writer can SUM large packed-decimal numbers incorrectly. The low-order digits are correct.

A reproducible case is attached. Linux-specific. Change the SELECT for other platforms.

The cause is in the cob_add_fields function in libcob/reportio.c.

Two temporary numeric fields are created for the values of the two operands. The temporary fields use the size (in bytes) of the operands for their size. Since the temporaries are not packed, they should use the number of digits instead of size or they will be too small when the operand is a large packed decimal value.

A patch for v3.2 is attached.

2 Attachments

Discussion


Log in to post a comment.

MongoDB Logo MongoDB