Hi,
I think there is bug in jdbc driver.
I need to add some parameters to query by PreparedStatement -
setString(1,'some text');
If the query begins with COPY (SELECT, it does not work.
1. it works
String query = "COPY (SELECT id, name FROM test_text WHERE id<10) TO
'/tmp/test.csv' csv";
con.createStatement().execute(query);
2. it does not work
String query = "COPY (SELECT id, name FROM test_text WHERE id<?) TO
'/tmp/test.csv' csv";
PreparedStatement st = con.prepareStatement(query);
st.setInt(1, 10);
st.execute();
It throws exception:
org.postgresql.util.PSQLException: ERROR: no value found for parameter 1
I tested it on jdbc driver version:
- PostgreSQL 8.3 JDBC3 with SSL (build 603)
Thanks
Ondrej Fafejta (fafi)