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 1nTmYh-0006BH-WA for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Mar 2022 15:24:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nTmXi-0005vb-Qa for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Mar 2022 15:23:30 +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 1nTmXi-0005vS-Hc for pgsql-hackers@lists.postgresql.org; Mon, 14 Mar 2022 15:23:30 +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 1nTmXg-0002gc-6o for pgsql-hackers@postgresql.org; Mon, 14 Mar 2022 15:23:30 +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 22EFNHol178941; Mon, 14 Mar 2022 11:23:17 -0400 From: Tom Lane To: Robert Haas cc: Dmitry Dolgov <9erthalion6@gmail.com>, Zhihong Yu , David Steele , PostgreSQL-development , Greg Stark , Pavel Trukhanov Subject: Re: pg_stat_statements and "IN" conditions In-reply-to: References: <20210616140212.kt3n5wi3alfz5i5d@localhost> <20210930134930.d4vzwhvxhfpk2zxt@localhost> <20210930150957.tz3h3unjyrzatw6e@localhost> <4154685.1641337363@sss.pgh.pa.us> <20220105211111.5oh7ypjfonaqubuq@erthalion.local> <20220310163837.pzvr4yntdk33cbkb@ddolgov.remote.csb> <655954.1646932319@sss.pgh.pa.us> <20220312141030.5panohzsskr4zpkk@erthalion.local> <20220314145734.x3re4hcr6ukmppwi@ddolgov.remote.csb> Comments: In-reply-to Robert Haas message dated "Mon, 14 Mar 2022 11:02:16 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <178939.1647271397.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 14 Mar 2022 11:23:17 -0400 Message-ID: <178940.1647271397@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Mon, Mar 14, 2022 at 10:57 AM Dmitry Dolgov <9erthalion6@gmail.com> w= rote: >> I'm not sure if I follow the last point. WHERE x in (1,3) and x =3D >> any(array[1,3]) are two different things for sure, but in which way are >> they going to be mixed together because of this change? My goal was to >> make only the following transformation, without leaving any uncertainty= : >> = >> WHERE x in (1, 2, 3, 4, 5) -> WHERE x in (1, 2, ...) >> WHERE x =3D any(array[1, 2, 3, 4, 5]) -> WHERE x =3D any(array[1, 2, ..= .]) > I understand. I think it might be OK to transform both of those > things, but I don't think it's very clear either from the comments or > the nonexistent documentation that both of those cases are affected -- > and I think that needs to be clear. We've transformed IN(...) to ANY(ARRAY[...]) at the parser stage for a long time, and this has been visible to users of either EXPLAIN or pg_stat_statements for the same length of time. I doubt people are going to find that surprising. Even if they do, it's not the query jumbler's fault. I do find it odd that the proposed patch doesn't cause the *entire* list to be skipped over. That seems like extra complexity and confusion to no benefit. regards, tom lane