Saturation Arithmetic with a PostgreSQL Extension
Introduction In certain situations, it can be beneficial to ignore integer overflow errors. Consider, for instance, an integer table column that typically accommodates small values. On rare occasions, a significantly larger value might be inserted. Attempting to aggregate these values could lead to an integer overflow error, causing the entire aggregate query to fail, which is far from ideal. Handling large values on the client or worker side, where the data is inserted, is one option....