Hi While reviewing some reports in pgsql-bugs I bumped into simple SQL reproduced of BRIN out of range issue
CREATE TABLE t (n numeric);
INSERT INTO t VALUES (1), (1e1000);
CREATE INDEX ON t USING brin (n numeric_minmax_multi_ops);
This fails. brin_minmax_multi_distance_numeric computes heuristic, so
it can be approximated. Patch uses numeric_sub_safe with an
ErrorSaveContext and returns inf if any error occurred (which can only
be an overflow in current code base, see make_result_safe)
The numeric-distance overflow risk was discussed during the original
minmax-multi development in 2018 [0], with normalizing value into 0-1
range. I didn't fix that way, the issue fixed in the current
implementation.
[0]
https://www.postgresql.org/message-id/[email protected]
--
Best regards,
Kirill Reshke
fix-t227-brin-minmax-multi-numeric-distance-v2.diff
Description: Binary data
