From: Tom Lane <tgl@sss.pgh.pa.us>
To: Anna Rodionova <anna.rodionova@jetbrains.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Relations between operators from pg_amop and classes of operators from pg_opclass
Date: Tue, 19 Oct 2021 21:02:11 -0400
Message-ID: <2094565.1634691731@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHMBQ-jaL7jCrxwKNy-nqbGbiZw3yWH9PNy2zM6uGEFQEWYifg@mail.gmail.com>
References: <CAHMBQ-jaL7jCrxwKNy-nqbGbiZw3yWH9PNy2zM6uGEFQEWYifg@mail.gmail.com>
Anna Rodionova <anna.rodionova@jetbrains.com> writes:
> For each operator from system catalog pg_amop I need to know - a member of
> which class of operators from system catalog pg_opclass it is (in case if
> such class of operators exists).
> In PostgreSQL versions before v14.0 I was able to get this information from
> system catalog pg_depend.
Not for built-in operators ...
> However in PostgreSQL v14.0 it changed. Now in such rows values of refobjid
> are equal to values of oid of family of operators (instead of class of
> operators).
That's always been possible, but it happens in more cases now. We made an
effort to not tie operators to opclasses unless they are essential to the
opclass. The exact rules are index AM dependent, and I don't think
they're documented outside of code comments. So if you really want to
know, have a look at [1], as well as the mailing list thread about it [2].
> How can I find relations between operators from pg_amop and classes of
> operators from pg_opclass in v14.0?
It's kind of a mistake to assume that there is any such relationship.
Operators are really tied to opfamilies, and have been for many years
--- and those relationships are in pg_amop, you needn't grovel around
in pg_depend to find them.
The only reason to tie an operator to a specific opclass is if a
particular index would necessarily not work without that operator.
The new code reduces the number of cases where we think an operator
is essential to an opclass when it is not really.
regards, tom lane
[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9f9682783
[2] https://www.postgresql.org/message-id/flat/4578.1565195302%40sss.pgh.pa.us
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, anna.rodionova@jetbrains.com
Subject: Re: Relations between operators from pg_amop and classes of operators from pg_opclass
In-Reply-To: <2094565.1634691731@sss.pgh.pa.us>
References: <CAHMBQ-jaL7jCrxwKNy-nqbGbiZw3yWH9PNy2zM6uGEFQEWYifg@mail.gmail.com> <2094565.1634691731@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox