Hi Dave,
I am a bit surprised with what you say since in the test case I provided, I call
getMetaData() on the PreparedStatement without having ever executed the PreparedStatement itself to get the ResultSet. And it works.
Do you mean that under the hook the PreparedStatement executes a query to be able to fetch the metadata ? (Then what would it be since a ResultSet could not be fetched without parameter values when the query has parameters.)
Unfortunately, I do not know if this behavior is consistent with previous versions of the JDBC driver.
Regards,
- Emmanuel
Emmanuel GUITON
Ingénieur Développement Fixe : +33170928416 l Standard : +33141917777
215, avenue Georges Clemenceau l 92024 Nanterre |
|
|
From: davecramer@gmail.com <davecramer@gmail.com> on behalf of Dave Cramer <pg@fastcrypt.com>
Sent: Thursday, December 19, 2013 2:35 PM
To: Emmanuel GUITON
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] "This ResultSet is closed" exception on a PreparedStatement getMetaData()
Emmanuel,
The assumption that the spec makes about the prepared statement being compiled are not valid for PostgreSQL. The metadata comes from the result set, not from the statement. You could in fact not call getMetaData on a statement which was not executed.
That being said, do you know if this behaviour is consistent with previous versions of the JDBC driver ?