aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2020-03-30 23:40:22 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2020-03-30 23:43:25 +0300
commit851b14b0c69b3773753a3c202bff42c3e4425d8d (patch)
treea914d7d7a08f75df5364d0e19ce852399c8b32ce /src/backend/access
parent4b42a89938ac9d2ec06e9d831356407040e9094c (diff)
downloadpostgresql-851b14b0c69b3773753a3c202bff42c3e4425d8d.tar.gz
postgresql-851b14b0c69b3773753a3c202bff42c3e4425d8d.zip
Remove rudiments of supporting procnum == 0 from 911e702077
Early versions of opclass options patch uses zero support procedure as opclass options procedure. This commit removes rudiments of it, which were committed in 911e702077. Also, it implements correct handling of amoptsprocnum == 0.
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/index/indexam.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index f7e4c65d99f..a3f77169a79 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -773,9 +773,9 @@ index_getprocid(Relation irel,
nproc = irel->rd_indam->amsupport;
- Assert(procnum >= 0 && procnum <= (uint16) nproc);
+ Assert(procnum > 0 && procnum <= (uint16) nproc);
- procindex = ((nproc + 1) * (attnum - 1)) + procnum;
+ procindex = (nproc * (attnum - 1)) + (procnum - 1);
loc = irel->rd_support;
@@ -809,9 +809,9 @@ index_getprocinfo(Relation irel,
nproc = irel->rd_indam->amsupport;
optsproc = irel->rd_indam->amoptsprocnum;
- Assert(procnum >= 0 && procnum <= (uint16) nproc);
+ Assert(procnum > 0 && procnum <= (uint16) nproc);
- procindex = ((nproc + 1) * (attnum - 1)) + procnum;
+ procindex = (nproc * (attnum - 1)) + (procnum - 1);
locinfo = irel->rd_supportinfo;
@@ -937,10 +937,14 @@ index_opclass_options(Relation indrel, AttrNumber attnum, Datum attoptions,
bool validate)
{
int amoptsprocnum = indrel->rd_indam->amoptsprocnum;
- Oid procid = index_getprocid(indrel, attnum, amoptsprocnum);
+ Oid procid = InvalidOid;
FmgrInfo *procinfo;
local_relopts relopts;
+ /* fetch options support procedure if specified */
+ if (amoptsprocnum != 0)
+ procid =index_getprocid(indrel, attnum, amoptsprocnum);
+
if (!OidIsValid(procid))
{
Oid opclass;