From 15f68e52c70b62b0e7051f2371f9ccf5c080a34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E7=A8=8B?= <517719039@qq.com> Date: Tue, 15 Apr 2025 15:37:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtinyint=20index=20in=20int=20?= =?UTF-8?q?array=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gausskernel/storage/access/nbtree/nbtutils.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gausskernel/storage/access/nbtree/nbtutils.cpp b/src/gausskernel/storage/access/nbtree/nbtutils.cpp index 616da34cc8..841d3eb496 100644 --- a/src/gausskernel/storage/access/nbtree/nbtutils.cpp +++ b/src/gausskernel/storage/access/nbtree/nbtutils.cpp @@ -440,11 +440,18 @@ int _bt_sort_array_elements(IndexScanDesc scan, const ScanKey skey, bool reverse * non-cross-type support functions for any datatype that it supports at * all. */ - cmp_proc = get_opfamily_proc(rel->rd_opfamily[skey->sk_attno - 1], elemtype, elemtype, BTORDER_PROC); + Oid opclass = GetDefaultOpClass(elemtype, BTREE_AM_OID); + if (InvalidOid == opclass) { + ereport(ERROR, + (errcode(ERRCODE_CASE_NOT_FOUND), errmsg("Invalid opclass for type %d.", elemtype))); + } + + Oid opfamily = get_opclass_family(opclass); + cmp_proc = get_opfamily_proc(opfamily, elemtype, elemtype, BTORDER_PROC); if (!RegProcedureIsValid(cmp_proc)) { ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("missing support function %d(%u,%u) in opfamily %u", BTORDER_PROC, elemtype, elemtype, - rel->rd_opfamily[skey->sk_attno - 1]))); + opfamily))); } /* Sort the array elements */ -- Gitee