Product Documentation

V11.5 Update Guide

Previous Topic

Next Topic

SQL - COUNT fix and new COUNT_BIG support

Running select count(*) returned the wrong result when the number of rows was greater than 2^31-1 (the maximum value that can be stored in a SQL INTEGER type). The COUNT aggregate function returns an INTEGER and, if the returned number overflowed the maximum allowed value, it returned a bad value instead of returning an error. This behavior has been fixed and an overflow error is properly returned.

To resolve the problem of counting rows when they are more the 2^31-1, a new aggregate function COUNT_BIG has been added in V11.5 and later. This function is like COUNT except that it returns a BIGINT instead of an INTEGER.

TOCIndex