Re: Index AM API cleanup
Mark Dilger <mark.dilger@enterprisedb.com>
On Wed, Mar 12, 2025 at 7:00 AM Peter Eisentraut <peter@eisentraut.org>
wrote:
> And another small patch set extracted from the bigger one, to keep
> things moving along:
>
> 0001: Add get_opfamily_method() in lsyscache.c, from your patch set.
>
Right, this came from v21-0006-*, with a slight code comment change and one
variable renaming. It is ready for commit.
0002: Add get_opfamily_member_for_cmptype(). This was called
> get_opmethod_member() in your patch set, but I think that name wasn't
> quite right. I also removed the opmethod argument, which was rarely
> used and is somewhat redundant.
>
This is also taken from v21-0006-*. The reason I had an opmethod argument
was that some of the callers of this function already know the opmethod,
and without the argument, this function has to look up the opmethod from
the syscache again. Whether that makes a measurable performance difference
is an open question.
Your version is ready for commit. If we want to reintroduce the opmethod
argument for performance reasons, we can always circle back to that in a
later commit.
0003 and 0004 are enabling non-btree unique indexes for partition keys
>
You refactored v21-0011-* into v21.2-0003-*, in which an error gets raised
about a missing operator in a slightly different part of the logic. I am
concerned that the new positioning of the check-and-error might allow the
flow of execution to reach the Assert(idx_eqop) statement in situations
where the user has defined an incomplete opfamily or opclass. Such a
condition should raise an error about the missing operator rather than
asserting.
In particular, looking at the control logic:
if (stmt->unique && !stmt->iswithoutoverlaps)
{
....
}
else if (exclusion)
....;
Assert(idx_eqop);
I cannot prove to myself that the assertion cannot trigger, because the
upstream logic before we reach this point *might* be filtering out all
cases where this could be a problem, but it is too complicated to prove.
Even if it is impossible now, this is a pretty brittle piece of code after
applying the patch.
Any chance you'd like to keep the patch closer to how I had it in
v21-0011-* ?
> and materialized views. These were v21-0011 and v21-0012, except that
> I'm combining the switch from strategies to compare types (which was in
> v21-0006 or so) with the removal of the btree requirements.
>
v21.2-0004-* is ready for commit.
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Relax ordering-related hardcoded btree requirements in planning
- a8025f544854 18.0 landed
-
Support non-btree indexes in get_actual_variable_range()
- 9ef1851685b7 18.0 landed
-
Convert PathKey to use CompareType
- 8123e91f5aeb 18.0 landed
-
Generalize index support in network support function
- be1cc9aaf5b7 18.0 landed
-
Update a code comment
- 190dc27998d5 18.0 landed
-
Allow non-btree unique indexes for matviews
- 9d6db8bec194 18.0 landed
-
Allow non-btree unique indexes for partition keys
- f278e1fe300a 18.0 landed
-
Add some opfamily support functions to lsyscache.c
- 7317e641268f 18.0 landed
-
Simplify and generalize PrepareSortSupportFromIndexRel()
- a359d3701991 18.0 landed
-
Generalize hash and ordering support in amapi
- ce62f2f2a0a4 18.0 landed
-
Drop opcintype from index AM strategy translation API
- 7d6d2c4bbd73 18.0 landed
-
Allow non-btree speculative insertion indexes
- b92c03342dcd 18.0 landed
-
Support non-btree indexes for foreign keys
- bfe21b760e03 18.0 landed
-
Integrate GistTranslateCompareType() into IndexAmTranslateCompareType()
- 622f678c1020 18.0 landed
-
Convert strategies to and from compare types
- c09e5a6a0165 18.0 landed
-
Move CompareType to separate header file
- 119fc30dd5bd 18.0 landed
-
Add get_opfamily_name() function
- 43493cceda2f 18.0 landed
-
Rename GistTranslateStratnum() to GistTranslateCompareType()
- a5709b5bb293 18.0 landed
-
Change gist stratnum function to use CompareType
- 630f9a43cece 18.0 landed
-
Rename RowCompareType to CompareType
- 6339f6468e82 18.0 landed
-
Improve slightly misleading internal error message
- 63e10988f870 18.0 landed
-
Track scan reversals in MergeJoin
- c594f1ad2ba7 18.0 landed
-
Track sort direction in SortGroupClause
- 0d2aa4d4937b 18.0 landed
-
Add stratnum GiST support function
- 7406ab623fee 18.0 cited
-
Add amgettreeheight index AM API routine
- 56fead44dcc7 18.0 landed