Re: pgsql: Add Result Cache executor node (take 2)

From: Andres Freund <andres(at)anarazel(dot)de>
To: David Rowley <drowley(at)postgresql(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Add Result Cache executor node (take 2)
Date: 2021-04-02 20:47:34
Message-ID: 20210402204734.6mo3nfacnljlicgn@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2021-04-02 21:42:04 pgsql: Remove useless Asserts in Result Cache code
Previous Message Bruce Momjian 2021-04-02 20:42:45 pgsql: Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib