Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1thuqC-008TlC-2l for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 18:18:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1thuqA-00DxET-7d for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 18:18:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1thuq9-00DxEK-RO for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 18:18:33 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1thuq5-000I4D-1O for pgsql-hackers@postgresql.org; Tue, 11 Feb 2025 18:18:33 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id 572B52540146; Tue, 11 Feb 2025 13:18:27 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Tue, 11 Feb 2025 13:18:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1739297907; x=1739384307; bh=k vHKkdKM9I6jhuykmGlAk3D+sH35YeB/JmRg+4IWI18=; b=dno2AkOHrFcwk9r1Z d7wedy/Tk/xKVj3uO2f0b3BFsAUuGnFtzXKg6nmW5VYO6XFnpSGRL0fF47knt3k4 6Xfx22c8V6YcM73d9wCdImnZSj9xCmJG/VZapFZ8rd+s3rWr61xLIelSiwOjI5If FQA5bQrqLmn0bnriFBnOwIvtklxZwcuLeSWVJ9AQ6xwiFb+hfyDX91+NLQ4MVZQx A0Lgg82kVz9b6qGFBv2uxMfxAFzdvP1s1YP1k2vhIwv/jrSPcjSrvSj/Xs76kCJ8 xP0UWyB54W8++ciWvnKag/oQoIZQIfc79x4m4OKlyFDznJYRHM4i95t8StxBz4sL UlYEA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdegudejtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdej necuhfhrohhmpemllhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvheeuffehgfeukeeufeeh hefghfeugfefudekjeevudffgeffkeegffffveegheenucffohhmrghinhepvghnthgvrh hprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspg hrtghpthhtohepudekpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehkohhusegt lhgvrghrqdgtohguvgdrtghomhdprhgtphhtthhopehmrghrtghoshesfhdutddrtghomh drsghrpdhrtghpthhtoheplegvrhhthhgrlhhiohhnieesghhmrghilhdrtghomhdprhgt phhtthhopehgvghiuggrvhdrphhgsehgmhgrihhlrdgtohhmpdhrtghpthhtohepnhgrth hhrghnuggsohhsshgrrhhtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphgrvhgvlhdr thhruhhkhhgrnhhovhesghhmrghilhdrtghomhdprhgtphhtthhopehrvghshhhkvghkih hrihhllhesghhmrghilhdrtghomhdprhgtphhtthhopehrohgsvghrthhmhhgrrghssehg mhgrihhlrdgtohhmpdhrtghpthhtohepshgrmhhimhhsvghihhesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 11 Feb 2025 13:18:25 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1739297903; bh=8C8Tju2GBtJv5eHJKjJe3OCDhZ3pJAymWmkGHKUp6+U=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Yi0epQbe1C+McnERIyInCJg0Nn8pm7UBt5tntA4bpYswZWG7KQmyyO4Mq9Jtcf5Tb FTvvVhFPbpcXonycmFERumVVc9SYomksIajKRHesyNJdKN7QBMul1ygI1uEz6aNeEC IzuT4TIM4oCVqdjDHlR1FTaR1vHcdmVcLf+RiR6SyrGPO415OxMPJeZ5/Y0L6iyvT5 J5Be8aJ4wXXVoaV8Ytp+zcdihCovm+hFuVfVoRW8TaXnMbmjmuRlbIFe1R6SzB1GRA SnuLAFiw6goqSFRhbrovN9e2qksmUgRsP3hW85N2wqp2TqWn5U5okYoS3/ZsKIQUm9 UUcy09xhbFnEg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id B2AE01B; Tue, 11 Feb 2025 19:18:23 +0100 (CET) Date: Tue, 11 Feb 2025 19:18:23 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Sami Imseih Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Kirill Reshke , Sergei Kornilov , yasuo.honda@gmail.com, tgl@sss.pgh.pa.us, smithpb2250@gmail.com, vignesh21@gmail.com, michael@paquier.xyz, nathandbossart@gmail.com, stark.cfm@gmail.com, geidav.pg@gmail.com, marcos@f10.com.br, robertmhaas@gmail.com, david@pgmasters.net, pgsql-hackers@postgresql.org, pavel.trukhanov@gmail.com, Sutou Kouhei Subject: Re: pg_stat_statements and "IN" conditions Message-ID: <202502111818.tbs5d7l5bvle@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Feb-11, Sami Imseih wrote: > I do not have an explanation from the patch yet, but I have a test > that appears to show unexpected results. I only tested a few datatypes, > but from what I observe, some merge as expected and others do not; > i.e. int columns merge correctly but bigint do not. Yep, I noticed this too, and realized that this is because these values are wrapped in casts of some sort, while the others are not. > select from foo where col_bigint in (1, 2, 3); > select from foo where col_bigint in (1, 2, 3, 4); > select from foo where col_bigint in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); > select from foo where col_float in (1, 2, 3); > select from foo where col_float in (1, 2, 3, 4); You can see that it works correctly if you use quotes around the values, e.g. select from foo where col_float in ('1', '2', '3'); select from foo where col_float in ('1', '2', '3', '4'); and so on. There are no casts here because these literals are of type unknown. I suppose this is telling us that detecting the case with consts wrapped in casts is not really optional. (Dmitry said this was supported at early stages of the patch, and now I'm really curious about that implementation because what IsMergeableConstList sees is a FuncExpr that invokes the cast function for float8 to int4.) -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "La fuerza no está en los medios físicos sino que reside en una voluntad indomable" (Gandhi)