pl/pgSQL, get diagnostics and big data

Поиск
Список
Период
Сортировка
От Andreas 'ads' Scherbaum
Тема pl/pgSQL, get diagnostics and big data
Дата
Msg-id 56AFBEF5.102@wars-nicht.de
обсуждение исходный текст
Ответы Re: pl/pgSQL, get diagnostics and big data  (Andreas 'ads' Scherbaum <adsmail@wars-nicht.de>)
Re: pl/pgSQL, get diagnostics and big data  (Christian Ullrich <chris@chrullrich.net>)
Список 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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Steele
Дата:
Сообщение: Re: PostgreSQL Audit Extension
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: extend pgbench expressions with functions