Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mczzn-0000dq-2O for pgsql-general@arkaria.postgresql.org; Wed, 20 Oct 2021 01:02:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mczzl-0008R4-GY for pgsql-general@arkaria.postgresql.org; Wed, 20 Oct 2021 01:02:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mczzl-0008Qv-6n for pgsql-general@lists.postgresql.org; Wed, 20 Oct 2021 01:02:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mczzi-00019S-AA for pgsql-general@lists.postgresql.org; Wed, 20 Oct 2021 01:02:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 19K12BRQ2094566; Tue, 19 Oct 2021 21:02:11 -0400 From: Tom Lane To: Anna Rodionova cc: pgsql-general@lists.postgresql.org Subject: Re: Relations between operators from pg_amop and classes of operators from pg_opclass In-reply-to: References: Comments: In-reply-to Anna Rodionova message dated "Wed, 20 Oct 2021 02:04:43 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2094564.1634691731.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 19 Oct 2021 21:02:11 -0400 Message-ID: <2094565.1634691731@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Anna Rodionova 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 i= f > such class of operators exists). > In PostgreSQL versions before v14.0 I was able to get this information f= rom > system catalog pg_depend. Not for built-in operators ... > However in PostgreSQL v14.0 it changed. Now in such rows values of refob= jid > 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=3Dpostgresql.git;a=3Dcommitdiff;h= =3D9f9682783 [2] https://www.postgresql.org/message-id/flat/4578.1565195302%40sss.pgh.p= a.us