From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | money type overflow checks |
Date: | 2016-08-05 16:04:19 |
Message-ID: | fb75784f-77ce-e6a7-fa74-922c73cfd93e@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The input function of the money type has no overflow checks:
=> select '12345678901234567890'::money;
money
-----------------------------
-$13,639,628,150,831,692.72
(1 row)
The tests in the regression test file money.sql are bogus because they
only test the overflow checks of the bigint type before the cast.
Here is a patch that adds appropriate checks and tests. We could
probably remove the bogus tests.
(Is checking for < 0 a valid overflow check? We save the sign until the
very end, so it ought to work. The code in int8.c works differently there.)
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
0001-Add-overflow-checks-to-money-type-input-function.patch | text/x-patch | 3.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-08-05 16:06:19 | Re: Parallel tuplesort (for parallel B-Tree index creation) |
Previous Message | Robert Haas | 2016-08-05 16:04:15 | Re: Re: [COMMITTERS] pgsql: Prevent "snapshot too old" from trying to return pruned TOAST tu |