Re: pgsql: Implement operator class parameters - Mailing list pgsql-committers

From Alexander Korotkov
Subject Re: pgsql: Implement operator class parameters
Date
Msg-id CAPpHfdsqPeV4usHas9zvYEuGd2RqNTsmfdQEGoUHtNoY5jg2sQ@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Implement operator class parameters  (Andres Freund <andres@anarazel.de>)
Responses Re: pgsql: Implement operator class parameters
List pgsql-committers
On Mon, Mar 30, 2020 at 9:36 PM Andres Freund <andres@anarazel.de> wrote:
> This triggers a few new (harmless) warnings for me:
> In file included from /home/andres/src/postgresql/src/include/postgres.h:46,
>                  from /home/andres/src/postgresql/src/backend/access/index/indexam.c:44:
> /home/andres/src/postgresql/src/backend/access/index/indexam.c: In function ‘index_getprocid’:
> /home/andres/src/postgresql/src/backend/access/index/indexam.c:782:17: warning: comparison is always true due to
limitedrange of data type [-Wtype-limits] 
>   782 |  Assert(procnum >= 0 && procnum <= (uint16) nproc);
>       |                 ^~
> /home/andres/src/postgresql/src/backend/access/index/indexam.c:782:2: note: in expansion of macro ‘Assert’
>   782 |  Assert(procnum >= 0 && procnum <= (uint16) nproc);
>       |  ^~~~~~
> /home/andres/src/postgresql/src/backend/access/index/indexam.c: In function ‘index_getprocinfo’:
> /home/andres/src/postgresql/src/backend/access/index/indexam.c:818:17: warning: comparison is always true due to
limitedrange of data type [-Wtype-limits] 
>   818 |  Assert(procnum >= 0 && procnum <= (uint16) nproc);
>       |                 ^~
> /home/andres/src/postgresql/src/include/c.h:782:9: note: in definition of macro ‘Assert’
>   782 |   if (!(condition)) \
>       |         ^~~~~~~~~
> PostgreSQL installation complete.

Thank you!  This reveals to me that this commit contains rudiments of
allowing procnum == 0.  I'll commit the fix soon.

BTW, what version of compiler (and options) do you use?  At the first
glance gcc and clang don't show these warnings to me.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



pgsql-committers by date:

Previous
From: Peter Geoghegan
Date:
Subject: pgsql: Consistently truncate non-key suffix columns.
Next
From: Alexander Korotkov
Date:
Subject: pgsql: Remove rudiments of supporting procnum == 0 from 911e702077