v22-0010-WIP-Allow-more-index-AMs-in-ALTER-OP-FAMILY.ADD.patch
text/plain
Filename: v22-0010-WIP-Allow-more-index-AMs-in-ALTER-OP-FAMILY.ADD.patch
Type: text/plain
Part: 9
Message:
Re: Index AM API cleanup
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v22-0010
Subject: WIP: Allow more index AMs in ALTER OP FAMILY..ADD
| File | + | − |
|---|---|---|
| src/backend/commands/opclasscmds.c | 5 | 1 |
From 26b8d12a1651c712bcd29335348647278371181d Mon Sep 17 00:00:00 2001 From: Mark Dilger <mark.dilger@enterprisedb.com> Date: Sat, 1 Mar 2025 04:59:37 -0800 Subject: [PATCH v22 10/10] WIP: Allow more index AMs in ALTER OP FAMILY..ADD The ALTER OPERATOR FAMILY .. ADD commands were assuming that ordering operators would only be added to btree, or to SpGIST and GIST which get their ordering operators from btree. That's not true any longer, so stop assuming it. --- src/backend/commands/opclasscmds.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index 8546366ee06..078eb39955b 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -921,7 +921,11 @@ AlterOpFamilyAdd(AlterOpFamilyStmt *stmt, Oid amoid, Oid opfamilyoid, } if (item->order_family) - sortfamilyOid = get_opfamily_oid(BTREE_AM_OID, + /* + * As an historical artifact, Gist and SpGist piggyback on + * Btree. Other opmethods should be independent. + */ + sortfamilyOid = get_opfamily_oid(amoid == SPGIST_AM_OID || amoid == GIST_AM_OID ? BTREE_AM_OID : amoid, item->order_family, false); else -- 2.49.0