On Thu, Jul 18, 2019 at 8:58 PM Hubert Zhang <hzhang@pivotal.io> wrote:
Is there any way to create a named portal except cursor in PG?
I tried postgres-jdbc driver and use PrepareStatement. Backend could receive `bind` and `execute` message, but the portal name is still empty. How can I specify the portal name?
This seems like a question better posed to the JDBC list as opposed to -hackers. The protocol can technically (from the description of parse+bind) handle what you describe but whether this specific client provides access to the capability is outside the scope of this list. I will say that there doesn't seem to be a way in pure SQL to use a prepared statement and have it create a named portal (PREPARE not allowing DECLARE to be the underlying statement).
You may wish to describe what you are trying to do at a higher level. If it is something like the above you might find a solution to your unspecified problem by using cursors within a pl/pgsql function.