Re: pgsql: Implement operator class parameters

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Alexander Korotkov <akorotkov(at)postgresql(dot)org>, pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Implement operator class parameters
Date: 2020-03-30 20:11:06
Message-ID: CAPpHfdsqPeV4usHas9zvYEuGd2RqNTsmfdQEGoUHtNoY5jg2sQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Mon, Mar 30, 2020 at 9:36 PM Andres Freund <andres(at)anarazel(dot)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 limited range 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 limited range 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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2020-03-30 20:43:35 pgsql: Remove rudiments of supporting procnum == 0 from 911e702077
Previous Message Peter Geoghegan 2020-03-30 19:04:18 pgsql: Consistently truncate non-key suffix columns.