aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2016-04-28 16:39:25 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2016-04-28 16:39:25 +0300
commitf8467f7da8685dbc47187864e5afe130d9c63fff (patch)
tree976dd6c7449fd96d07d0e17661a4d561fc0ab8af /src/backend/access
parente2c79e14d998cd31f860854bc9210b37b457bb01 (diff)
downloadpostgresql-f8467f7da8685dbc47187864e5afe130d9c63fff.tar.gz
postgresql-f8467f7da8685dbc47187864e5afe130d9c63fff.zip
Prevent to use magic constants
Use macroses for definition amstrategies/amsupport fields instead of hardcoded values. Author: Nikolay Shaplov with addition for contrib/bloom
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/gin/ginutil.c2
-rw-r--r--src/backend/access/gist/gist.c2
-rw-r--r--src/backend/access/hash/hash.c4
-rw-r--r--src/backend/access/nbtree/nbtree.c4
-rw-r--r--src/backend/access/spgist/spgutils.c2
5 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index 94502678abb..a2450f4687e 100644
--- a/src/backend/access/gin/ginutil.c
+++ b/src/backend/access/gin/ginutil.c
@@ -35,7 +35,7 @@ ginhandler(PG_FUNCTION_ARGS)
IndexAmRoutine *amroutine = makeNode(IndexAmRoutine);
amroutine->amstrategies = 0;
- amroutine->amsupport = 6;
+ amroutine->amsupport = GINNProcs;
amroutine->amcanorder = false;
amroutine->amcanorderbyop = false;
amroutine->amcanbackward = false;
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 996363c2ded..a29088728d2 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -57,7 +57,7 @@ gisthandler(PG_FUNCTION_ARGS)
IndexAmRoutine *amroutine = makeNode(IndexAmRoutine);
amroutine->amstrategies = 0;
- amroutine->amsupport = 9;
+ amroutine->amsupport = GISTNProcs;
amroutine->amcanorder = false;
amroutine->amcanorderbyop = true;
amroutine->amcanbackward = false;
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index 8c89ee7108b..4fececeab8c 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -51,8 +51,8 @@ hashhandler(PG_FUNCTION_ARGS)
{
IndexAmRoutine *amroutine = makeNode(IndexAmRoutine);
- amroutine->amstrategies = 1;
- amroutine->amsupport = 1;
+ amroutine->amstrategies = HTMaxStrategyNumber;
+ amroutine->amsupport = HASHNProcs;
amroutine->amcanorder = false;
amroutine->amcanorderbyop = false;
amroutine->amcanbackward = true;
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index bf8ade375d1..013394c5b62 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -84,8 +84,8 @@ bthandler(PG_FUNCTION_ARGS)
{
IndexAmRoutine *amroutine = makeNode(IndexAmRoutine);
- amroutine->amstrategies = 5;
- amroutine->amsupport = 2;
+ amroutine->amstrategies = BTMaxStrategyNumber;
+ amroutine->amsupport = BTNProcs;
amroutine->amcanorder = true;
amroutine->amcanorderbyop = false;
amroutine->amcanbackward = true;
diff --git a/src/backend/access/spgist/spgutils.c b/src/backend/access/spgist/spgutils.c
index 201203f91a3..bc679bf75a0 100644
--- a/src/backend/access/spgist/spgutils.c
+++ b/src/backend/access/spgist/spgutils.c
@@ -36,7 +36,7 @@ spghandler(PG_FUNCTION_ARGS)
IndexAmRoutine *amroutine = makeNode(IndexAmRoutine);
amroutine->amstrategies = 0;
- amroutine->amsupport = 5;
+ amroutine->amsupport = SPGISTNProc;
amroutine->amcanorder = false;
amroutine->amcanorderbyop = false;
amroutine->amcanbackward = false;