Oliver Jowett <oliver@opencloud.com> writes:
> The JDBC driver currently sends Describe/Execute and expects exactly one
> of RowDescription/NoData followed by zero or more DataRows followed by
> one of CommandComplete/EmptyQueryResponse/PortalSuspended. This seems
> wrong if there could be multiple resultsets from a single Execute.
This is okay if you know the query was a SELECT, since we don't allow
ON SELECT rules that aren't view-like (ie, DO INSTEAD SELECT something-else).
Non-SELECT queries can return multiple result sets, though, as I
illustrated. It's probably reasonable for the driver to throw these
away if it's not looking for a resultset at all. Or you could follow
PQexec's lead and discard all but the last.
> How can clients distinguish multiple resultsets if they're using the
> extended query protocol?
You'll get multiple repetitions of RowDescription/DataRows.
regards, tom lane