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 1pV7HQ-0000Lb-NQ for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Feb 2023 08:48:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pV7HO-0005UY-Iw for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Feb 2023 08:48:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pV7HO-0005Ks-7L for pgsql-hackers@lists.postgresql.org; Thu, 23 Feb 2023 08:48:42 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pV7HM-0004B2-1i for pgsql-hackers@postgresql.org; Thu, 23 Feb 2023 08:48:41 +0000 Received: by mail-ed1-x529.google.com with SMTP id x10so38727995edd.13 for ; Thu, 23 Feb 2023 00:48:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Q6+nZ1tu9ZtiumlkzBG7SwXa0pNBIJRCSJUdIdctSfI=; b=KqCafvf9fIorrgIzO4ctq2+hqz18LXxaN8Mje5LYeWoAh+4rNKZY6ugarMTqFW0SIa 5JLb/oRk5OA+oi4oym85FIj1GwxRjIoiWia9OwDz6ZcXpB2BF2RbTKC24mvLZNcSIti7 6ut3gY6k6M+HSvU+1yYcC2A9Oj7VZebrbUqwOp4AdNJvRqVnSVUkun4m/XgufvEfuaNQ dokbh4hl8fyvgE8My/IBaJrYiS647NQsigPJkr8G1gF1uWbQV6mW08l4/LzlIjrdofGg 99+5PxWrNf3r/taObo4UdoPLlrDTWvloBLw+/W10DXoCqghrWkcd5LaraQ3mq2J/L/dC Hf+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q6+nZ1tu9ZtiumlkzBG7SwXa0pNBIJRCSJUdIdctSfI=; b=uVbuRKt/VgFvAd5+80xOSoaotuLO/mJ+Vf7qP8T1LOgXOdV6ih5dWxyXiVD7g/TBdp +/KU2dMKNM+Dl4Aa582rvu0NqTknC7PB8eo5rBdmJKcQKbH0zJxbGjiEty+BjRIFH47w SEdVg2t+jJHawBsKaq3y6xsRxbunQykAFpc/bN9c7lO7k8Ih8N+IaRrXDaHx54vHJJ6p OmESMsQ9jv/6gw992DXFIiyK5dhYAtNeqo4UWiiWzYFMzSakuUjKsT/fXn/np1ppszY/ 8F6htg8Rd0RJug6eUNIQ1GXIlV1zir1UVcgXl6qEh8tkJ2yZ3rmkuw9YH2k/lY0F4Sfq QsCg== X-Gm-Message-State: AO0yUKVBRT6+U66HX4AfrUkEbNrbqzm1TrE1ivDTVN0WJIfxsZYxOEsW 8jqkSc63mj+lRUNeaVyLYyQ= X-Google-Smtp-Source: AK7set8IveMAGwyr7xk/q722WNq9S+s0wsDYWPdrHmdRF3p4Ot47YEninPYtOfPSQt7Nkwa6U8YjGw== X-Received: by 2002:a17:907:7fa0:b0:8b1:72e5:9001 with SMTP id qk32-20020a1709077fa000b008b172e59001mr30955501ejc.0.1677142117555; Thu, 23 Feb 2023 00:48:37 -0800 (PST) Received: from [172.16.209.129] ([147.161.235.10]) by smtp.gmail.com with ESMTPSA id ck20-20020a170906c45400b008c95f0ce32esm5905262ejb.3.2023.02.23.00.48.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Feb 2023 00:48:37 -0800 (PST) Message-ID: <8702fa3e-5aac-dcf0-161b-faa2b9eadad6@gmail.com> Date: Thu, 23 Feb 2023 09:48:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: pg_stat_statements and "IN" conditions Content-Language: en-US To: Dmitry Dolgov <9erthalion6@gmail.com> Cc: Sergei Kornilov , Michael Paquier , Alvaro Herrera , Marcos Pegoraro , vignesh C , Robert Haas , Zhihong Yu , David Steele , PostgreSQL-development , Greg Stark , Pavel Trukhanov , Tom Lane References: <20230205113346.gmbf5ycnukuhnmqa@erthalion.local> <2420105.1675612952@sss.pgh.pa.us> <20230205195600.e3bhwszzm5kdyyxl@erthalion.local> <966631675800892@znolar4klagewshm.sas.yp-c.yandex.net> <20230209150238.rdtwruh5i34hdag5@ddolgov.remote.csb> <20230211104707.grsicemegr7d3mgh@erthalion.local> <20230211120820.y7krq37jubnjsa5b@erthalion.local> <07919318-6c35-a13f-6a1d-98686a3e38de@gmail.com> <20230217154602.uf3a3cgqeoeysycz@erthalion.local> From: David Geier In-Reply-To: <20230217154602.uf3a3cgqeoeysycz@erthalion.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, >> Seems like supporting only constants is a good starting >> point. The only thing that is likely confusing for users is that NUMERICs >> (and potentially constants of other types) are unsupported. Wouldn't it be >> fairly simple to support them via something like the following? >> >>     is_const(element) || (is_coercion(element) && is_const(element->child)) > It definitely makes sense to implement that, although I don't think it's > going to be acceptable to do that via directly listing conditions an > element has to satisfy. It probably has to be more flexible, sice we > would like to extend it in the future. My plan is to address this in a > follow-up patch, when the main mechanism is approved. Would you agree > with this approach? I still think it's counterintuitive and I'm pretty sure people would even report this as a bug because not knowing about the difference in internal representation you would expect NUMERICs to work the same way other constants work. If anything we would have to document it. Can't we do something pragmatic and have something like IsMergableInElement() which for now only supports constants and later can be extended? Or what exactly do you mean by "more flexible"? -- David Geier (ServiceNow)