Hi,
On 2021-04-02 01:11:35 +0000, David Rowley wrote:
> Add Result Cache executor node (take 2)
Since this commit I am seeing
In file included from /home/andres/src/postgresql/src/include/postgres.h:46,
from /home/andres/src/postgresql/src/backend/executor/nodeResultCache.c:67:
/home/andres/src/postgresql/src/backend/executor/nodeResultCache.c: In function ‘entry_purge_tuples’:
/home/andres/src/postgresql/src/backend/executor/nodeResultCache.c:290:27: warning: comparison of unsigned expression
in‘>= 0’ is always true [-Wtype-limits]
290 | Assert(rcstate->mem_used >= 0);
| ^~
/home/andres/src/postgresql/src/include/c.h:848:9: note: in definition of macro ‘Assert’
848 | if (!(condition)) \
| ^~~~~~~~~
/home/andres/src/postgresql/src/backend/executor/nodeResultCache.c: In function ‘remove_cache_entry’:
/home/andres/src/postgresql/src/backend/executor/nodeResultCache.c:349:27: warning: comparison of unsigned expression
in‘>= 0’ is always true [-Wtype-limits]
349 | Assert(rcstate->mem_used >= 0);
| ^~
/home/andres/src/postgresql/src/include/c.h:848:9: note: in definition of macro ‘Assert’
848 | if (!(condition)) \
| ^~~~~~~~~
Now, it's a bit of an over-pedantic warning, but it's also kinda right,
ensuring that a variable that cannot be negative is bigger than 0 is a
bit redundant.
Greetings,
Andres Freund