Re: future of PQfn()

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Jacob Champion <jacob.champion@enterprisedb.com>
Cc: pgsql-hackers@postgresql.org
Date: 2026-05-26T19:55:09Z
Lists: pgsql-hackers
On Tue, May 26, 2026 at 10:42:47AM -0700, Jacob Champion wrote:
> Short-term, keeping it around seems fine.
> 
> Long-term, it doesn't feel great that the alternatives we tell other
> people to use are... worse. Surely other clients of libpq run into the
> layering violation problem with prepared statements, as well?

Yup.  Here's a related note in JDBC:

	https://github.com/pgjdbc/pgjdbc/blob/cf2d89ec/docs/content/documentation/server-prepare.md?plain=1#L305-L315

I wonder how difficult it would be to teach the protocol to advise clients
when prepared statements are deallocated...

FWIW I'm less concerned about the name collision problem.  I was thinking
we could just document that libpq manages statements with a prefix like
"libpq_internal_".  Any problems in that area seem likely to be intentional
breakage that we needn't worry about.

-- 
nathan