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 1puCiz-0001GK-Fc for pgsql-bugs@arkaria.postgresql.org; Wed, 03 May 2023 13:40:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1puCiy-0003wv-2L for pgsql-bugs@arkaria.postgresql.org; Wed, 03 May 2023 13:40:52 +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 1puCix-0003wm-QB for pgsql-bugs@lists.postgresql.org; Wed, 03 May 2023 13:40:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1puCit-000Lpq-FM for pgsql-bugs@lists.postgresql.org; Wed, 03 May 2023 13:40:51 +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 343Dei1w2956975; Wed, 3 May 2023 09:40:44 -0400 From: Tom Lane To: rekgrpth@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17916: Expression IN list translates to unqualified operator In-reply-to: <17916-8d713fd64529da21@postgresql.org> References: <17916-8d713fd64529da21@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 03 May 2023 05:19:07 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2956973.1683121244.1@sss.pgh.pa.us> Date: Wed, 03 May 2023 09:40:44 -0400 Message-ID: <2956974.1683121244@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > create operator qwe.= (leftarg = char, rightarg = text, function = > qwe.chartexteq, commutator = operator(qwe.=), hashes, merges); > set search_path = qwe; > explain (costs off, verbose on) select i from generate_series(1, 10) i where > i::char in (2::text); > I expected, that IN list translates to pg_catalog.= Why would you expect that? It'd make it impossible to use IN with user-defined data types. In this case, you made an operator that is a closer match to the given datatypes (ie, "char = text") than the native "text = text" operator, so it used that one. I've not checked the code, but my recollection is that X IN (Y) just resolves to the same equality operator you'd get by writing X = Y. There's been some discussion about allowing a schema qualifier to be included in the syntax, but nothing's been done about that. regards, tom lane