pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: rekgrpth@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17916: Expression IN list translates to unqualified operator
Date: Wed, 03 May 2023 09:40:44 -0400
Message-ID: <2956974.1683121244@sss.pgh.pa.us> (raw)
In-Reply-To: <17916-8d713fd64529da21@postgresql.org>
References: <17916-8d713fd64529da21@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> 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





view thread (4+ messages)  latest in thread

Message-ID: <2956974.1683121244@sss.pgh.pa.us>
Permalink:  ../2956974.1683121244@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2956974.1683121244@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rekgrpth@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17916: Expression IN list translates to unqualified operator
  In-Reply-To: <2956974.1683121244@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