From: | Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Cc: | pgsql-committers(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: pgsql: Generalize hash and ordering support in amapi |
Date: | 2025-03-04 17:23:49 |
Message-ID: | CAHgHdKu0xiwifh=z0oecKR9+anyJZvjRwFkDiTENWS9tz8qm_A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
On Tue, Mar 4, 2025 at 8:46 AM Peter Eisentraut <peter(at)eisentraut(dot)org>
wrote:
> On 27.02.25 23:17, Mark Dilger wrote:
> > The logic in equality_ops_are_compatible() was trusting that equality
> > operators found in an opfamily for btree or hash were ok, but not
> > trusting operators found in opfamilies of other AMs. Now, after the
> > patch, other AMs can be marked as suitable. That's really the core of
> > what the flag means: "Can the system trust that equality operators
> > found in opfamilies of the AM are well-behaved", or something like
> > that.
>
> Yeah, what might be a good English identifier for that?
>
> > I also object strongly to the fact that the comments for
> > equality_ops_are_compatible and comparison_ops_are_compatible
> > were not modified:
> >
> > * This is trivially true if they are the same operator. Otherwise,
> > * we look to see if they can be found in the same btree or hash
> > opfamily.
> >
> > * This is trivially true if they are the same operator. Otherwise,
> > * we look to see if they can be found in the same btree opfamily.
> >
> > I agree these comments need updating.
>
> Mark, can you suggest updated wording for those?
>
>
Yes, happily, though I think I already did, in the v21 patch set. Here is
the meat of that patch:
- * This is trivially true if they are the same operator. Otherwise,
- * we look to see if they can be found in the same btree or hash opfamily.
- * Either finding allows us to assume that they have compatible notions
- * of equality. (The reason we need to do these pushups is that one might
- * be a cross-type operator; for instance int24eq vs int4eq.)
+ * This is trivially true if they are the same operator. Otherwise, we
look to
+ * see if they can be found in the same opfamily of an index AM which
+ * advertises amcancrosscompare. Either finding allows us to assume that
they
+ * have compatible notions of equality. (The reason we need to do these
+ * pushups is that one might be a cross-type operator; for instance
int24eq vs
+ * int4eq.)
and
- * This is trivially true if they are the same operator. Otherwise,
- * we look to see if they can be found in the same btree opfamily.
- * For example, '<' and '>=' ops match if they belong to the same family.
+ * This is trivially true if they are the same operator. Otherwise, we
look to
+ * see if they can be found in the same opfamily of an index AM that
advertises
+ * both amcancrosscompare and amcanorder. For example, '<' and '>=' ops
match
+ * if they belong to the same family.
*
- * (This is identical to equality_ops_are_compatible(), except that we
- * don't bother to examine hash opclasses.)
+ * (This is identical to equality_ops_are_compatible(), except that we
don't
+ * bother to examine opclasses for index AMs which cannot do ordering,
such as
+ * the hash index AM.)
See v21-0003-Update-syscache-code-comments.patch for the whole thing,
including a commit message about why this is needed.
--
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2025-03-04 17:34:32 | pgsql: Make FP_LOCK_SLOTS_PER_BACKEND look like a function |
Previous Message | Peter Eisentraut | 2025-03-04 16:46:01 | Re: pgsql: Generalize hash and ordering support in amapi |