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