Figure out nullability of query parameters

From: Giacomo Cavalieri <giacomo(dot)cavalieri(at)icloud(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Figure out nullability of query parameters
Date: 2025-06-27 14:30:41
Message-ID: 4915B05B-90B6-4CC2-86E7-EF7C1E2E38C9@icloud.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!
I’m Giacomo, I’m the maintainer of <https://github.com/giacomocavalieri/squirrel>, a tool that can generate type safe bindings to run and decode the results of Postgres queries. It does that by implementing the extended query protocol, which, among other things, returns the OIDs of the query parameters’ types.
This is really handy and has worked great so far but I’m running into some rough edges when it comes to the nullability of query parameters.

Take a query like this one:
```
insert into some_table(not_null_col, nullable_column)
values ($1, $2)
```
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?

Sorry if this is not the proper list, I’m very new to all of this :)
Thanks!

Giacomo

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Petr Kada 2025-06-27 14:45:02 Re: Figure out nullability of query parameters
Previous Message Ron Johnson 2025-06-27 13:41:39 Re: analyze-in-stages post upgrade questions