On Tue, Mar 11, 2025 at 05:23:14PM +0100, Frits Hoogland wrote: > The usecase that I think might be useful is to have a database client send > metadata along with a query. > This partially is possible today by setting application_name, but that is a > separate request, it would be great if that could be sent along with the > query in one go. > Another option to pass metadata is to add a comment (/* .. */), but a comment > cannot be set for a prepared statement, because the statement is prepared > first and then later invoked on runtime, which executes a query that is fixed.
How about using a `set_config()` to deonte the "application_name" (and any other details) for the _next_ query, then have those details appear in the pg_stat_statements rows and logs? Clients would send a `SELECT set_config(...)` and also the next query one after the other without waiting for the response to the first. The server could similarly batch the two responses. Look ma', no protocol change. Nico --