From: | Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | pl/pgSQL, get diagnostics and big data |
Date: | 2016-02-01 20:24:21 |
Message-ID: | 56AFBEF5.102@wars-nicht.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
one of our customers approached us and complained, that GET DIAGNOSTICS
row_count returns invalid results if the number of rows is > 2^31. It's
a bit complicated to test for this case, so I set up a separate instance
with this patch, and inserted 2^32+x rows into a table. Internally,
row_count it's a signed integer, the resulting number is negative:
diagnostics=# select testfunc_pg((2^31 + 50000)::bigint);
testfunc_pg
-------------
-2147433648
(1 row)
Going over 2^32 wraps around:
diagnostics=# select testfunc_pg((2^32 + 50000)::bigint);
testfunc_pg
-------------
50000
(1 row)
Attached patch expands the row_count to 64 bit.
diagnostics=# select testfunc_pg((2^32 + 50000)::bigint);
testfunc_pg
-------------
4295017296
(1 row)
I hope, I covered all the places which count the result set.
Regards,
--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project
Attachment | Content-Type | Size |
---|---|---|
64bit_3.diff | text/x-patch | 6.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2016-02-01 20:53:49 | Re: extend pgbench expressions with functions |
Previous Message | David Steele | 2016-02-01 19:32:10 | Re: PostgreSQL Audit Extension |