[PATCH] amroutine->amsupport from numeric to defined constants

Started by Nikolay Shaplovalmost 10 years ago3 messageshackers
Jump to latest
#1Nikolay Shaplov
n.shaplov@postgrespro.ru

While working with postgres code, I found that for gist index number of
amsupport procs are defined two times. First in src/include/access/gist.h

#define GISTNProcs 9

and second in src/backend/access/gist/gist.c

amroutine->amsupport = 9;

I think this number should be specified only once, in .h file.

So I would offer a patch for all access methods. That changes amsupport and
amstrategies from numbers to defined constants. (I've added two of them where
they were missing)

See attachment.

If it is good, I will add it to the commitfest.

--
Nikolay Shaplov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

Attachments:

amsupport-to-defined-constants2.difftext/x-patch; charset=UTF-8; name=amsupport-to-defined-constants2.diffDownload+9-7
#2Michael Paquier
michael@paquier.xyz
In reply to: Nikolay Shaplov (#1)
Re: [PATCH] amroutine->amsupport from numeric to defined constants

On Tue, Apr 26, 2016 at 10:17 PM, Nikolay Shaplov
<n.shaplov@postgrespro.ru> wrote:

While working with postgres code, I found that for gist index number of
amsupport procs are defined two times. First in src/include/access/gist.h

#define GISTNProcs 9

and second in src/backend/access/gist/gist.c

amroutine->amsupport = 9;

I think this number should be specified only once, in .h file.

Yep, that sounds true.

So I would offer a patch for all access methods. That changes amsupport and
amstrategies from numbers to defined constants. (I've added two of them where
they were missing)

It may be a good idea to make something similar for contrib/bloom if >
0 values are defined for amstrategies or amsupport for consistency.
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Teodor Sigaev
teodor@sigaev.ru
In reply to: Michael Paquier (#2)
Re: [PATCH] amroutine->amsupport from numeric to defined constants

I think this number should be specified only once, in .h file.

Yep, that sounds true.
It may be a good idea to make something similar for contrib/bloom if >
0 values are defined for amstrategies or amsupport for consistency.

Thank you, pushed.

--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers