Subject: Re: Figure out nullability of query parameters

From: "David G. Johnston" <[email-masked]>
Date: Fri, 27 Jun 2025 07:52:56 -0700

On Friday, June 27, 2025, Giacomo Cavalieri <[email-masked]>
wrote:

>
> It would be really handy to know that `$1` is being used as a non nullable
> 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’t 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’ve shown here is part of that.
Not sure we’d turn it down but someone will need to step up and scratch
their own itch in all likelihood (the request for similar functionality in
the result comes up too).

David J.

---

From: Greg Sabino Mullane <[email-masked]>
Date: Fri, 27 Jun 2025 11:15:26 -0400

> value

To push back in a different way, how exactly would this be useful?

The system catalogs are the best place to get all the various information
about a relation, including any and all constraints. Data type info via
protocol, yes, but constraints seems a whole other level of bother.

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support