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 1uVARr-00Eep9-DO for pgsql-general@arkaria.postgresql.org; Fri, 27 Jun 2025 14:53:03 +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 1uVARp-002ZSn-HQ for pgsql-general@arkaria.postgresql.org; Fri, 27 Jun 2025 14:53:02 +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 1uVARp-002ZSf-76 for pgsql-general@lists.postgresql.org; Fri, 27 Jun 2025 14:53:01 +0000 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uVARn-004QCA-2U for pgsql-general@lists.postgresql.org; Fri, 27 Jun 2025 14:53:01 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-60f0a92391bso1110085eaf.0 for ; Fri, 27 Jun 2025 07:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751035977; x=1751640777; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=pny0iqlKoAy991NLM9USYLcEsSqeyXnxaailxVpZZsE=; b=Gd62bbpeUTr0+CxrrCcOUzoDPyDRskUznwvrup2raEDnnAULoMlyTbccIXGkmACSF5 dqKDXQtxkMp23JKxLXGMHkXy4waw3/7HfWvJQTokrN6reXqP/KKI9nkEPhZk13Aslb3c 9WgdrEyl3KHl4LCvkqbw8usgx5uk7ZYHE/gKcakLIUtr2xDKjXDT8hd/8PfbGghMZewT hd3aH0KLgubSa5gZTuQ5JSKj1pXLWnQb0od+d4Slf+0mu1WnhOSi8Vmupa/lJdpwGUP0 RBmaRope7TS2qBvsFWRp6K3Gy5cShoMjbQ59dnN9xscVi4/3EiecYG46Ad/J+a+p3wdW YvcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751035977; x=1751640777; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pny0iqlKoAy991NLM9USYLcEsSqeyXnxaailxVpZZsE=; b=GUbfD1PJcfT7W+crk2FKbZi7YnybWmoMLJgHnNfp7N1jEpkCv5Z8rgfk3Jc64Npgt9 iK6vBPvKC2zAM/CuTc8wvaBar3+XFkZvLQGtUorIJF9UCJsrTyRYqLfjWwHvq/fjgICJ w/9PI5hrvB/Gn0lVOVxiTscngB/+KAQWDBzys5QzPfBS1uwjrfrujuoEScdqxygVxhQe mHl6e5CEdEQ64LI+QeuMPkKsFk4jzVsS3wOmQbi5+ohRF1eOLdVrL5pL8duewr41gbeu oSoBVllvnFYZQyFkbpLa/0bJ0BZlzIvIpDCFJIufHjF0SlbU7pOlxtLNKOLECgzLTU/B hk8g== X-Gm-Message-State: AOJu0Yzxd8aOeE6OWCYQuHleBX7wckH6TuXL/DNZX+rfb7oZUQ+c1QOs DUjtTp3XTqDxiBhY7BwMl0x8bQe+p4HmFxDXeEC39LLtymXmnXop3/L8fCaXc4gTL9u+NyVmQjx kyeWPzsBJvLB3uZMJsZOx63jBXR+aeRw= X-Gm-Gg: ASbGncv4Lt1sMrt8WDedFNvAmFFxHk15A0NfP281hL8QdML6huY7LxDeRPO8MCS7Y4R oMqBIetGEgqr1p61bXHy+f1T5FNCI/I6cS30Kt2M3xoMlW1GB5PXAnr850umQkyyypx1Xxb9AcY qbe4/2P5QfDy4mtF6OP1JteZcIcwS5wX+XH2p7mdL16FtZ1z1E14S6qe6FKUZ3I4wGhETRc/u5j 2Q4bqVAv/69hNM= X-Google-Smtp-Source: AGHT+IHvS2B9eETMEdLSfgpjrFXwmgSHYpB4tBGd8xkdAHhERCVT2Elz80WzMK1j6n5l3lJB/H1kUPVZIZMuMrVKyfo= X-Received: by 2002:a05:6820:151c:b0:611:a921:bfef with SMTP id 006d021491bc7-611b9099bcfmr1820510eaf.8.1751035977576; Fri, 27 Jun 2025 07:52:57 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6802:4104:b0:5d1:adff:a37f with HTTP; Fri, 27 Jun 2025 07:52:56 -0700 (PDT) In-Reply-To: <4915B05B-90B6-4CC2-86E7-EF7C1E2E38C9@icloud.com> References: <4915B05B-90B6-4CC2-86E7-EF7C1E2E38C9@icloud.com> From: "David G. Johnston" Date: Fri, 27 Jun 2025 07:52:56 -0700 X-Gm-Features: Ac12FXxeIuqsQNp9zmI6OrB1729iYAoFxN1cVe3kzHaMlk2JNwqnHlkfAqL_gtI Message-ID: Subject: Re: Figure out nullability of query parameters To: Giacomo Cavalieri Cc: "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000006eb77106388ed588" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000006eb77106388ed588 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Friday, June 27, 2025, Giacomo Cavalieri wrote: > > It would be really handy to know that `$1` is being used as a non nullabl= e > value, while `$2` could actually be null. Can this already be achieve > today, or would there be a way to surface this kind of information for > query parameters in the extended protocol? > There is no attempt in the system to try and pass constraint information through the query planner and expose it to the client. It doesn=E2=80=99t = seem like there is sufficient utility to try and do so. The fact that it pretty much only works in the exact query form you=E2=80=99ve shown here is part o= f that. Not sure we=E2=80=99d turn it down but someone will need to step up and scr= atch their own itch in all likelihood (the request for similar functionality in the result comes up too). David J. --0000000000006eb77106388ed588 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Friday, June 27, 2025, Giacomo Cavalieri <giacomo.cavalieri@icloud.com> wrote:

It would be really handy to know that `$1` is being used as a non nullabl= e value, while `$2` could actually be null. Can this already be achieve tod= ay, or would there be a way to surface this kind of information for query p= arameters in the extended protocol?

=
There is no attempt in the system to try and pass constraint informati= on through the query planner and expose it to the client.=C2=A0 It doesn=E2= =80=99t seem like there is sufficient utility to try and do so.=C2=A0 The f= act that it pretty much only works in the exact query form you=E2=80=99ve s= hown here is part of that.=C2=A0 Not sure we=E2=80=99d turn it down but som= eone will need to step up and scratch their own itch in all likelihood (the= request for similar functionality in the result comes up too).
<= br>
David J.

--0000000000006eb77106388ed588--