Org.lucee.postgresql JDBC driver dated - how would we update it?

Hi,

Seems to me that Karaf OSGi specifics are not the only thing that’s
breaking with the driver update. I just now stumbled over this discussion
RETURNING * blindy appended to prepared batch when clause already exists in statement · Issue #488 · pgjdbc/pgjdbc · GitHub - and yes, after upgrading the
driver it tacked a “RETURNING *” clause blindly to each and every query,
which breaks all of the SELECTs and a couple of other queries with explicit
RETURNING clauses as well. Seems to me to be a questionable design decision
on behalf of the PostgreSQL JDBC team, but OTOH as far as I understand the
gist of the discussion, there’s currently just no chance to provide a
cleaner solution.

I remember hacking a Postgresql-9.3 JDBC 4 build for ACF a long time ago,
though it was an ugly hack as I simply removed the whole “RETURNING *”
magic altogether, which may or may not break other stuff that I am not
aware of. It certainly is not the canoncial way to do things.Just for good
measure, here’s the patch to the driver, I assume that the general
implementation of this hasn’t changed much, so it might still work with
more recent versions:

diff -br postgresql-jdbc-9.3-1102.src/org/postgresql/jdbc3/AbstractJdbc3Connection.java postgresql-jdbc-9.3-1102.src.patched/org/postgresql/jdbc3/AbstractJdbc3Connection.java363,371c363< if (autoGeneratedKeys != Statement.NO_GENERATED_KEYS)< sql = AbstractJdbc3Statement.addReturning(this, sql, new String[]{““}, false);<< PreparedStatement ps = prepareStatement(sql);<< if (autoGeneratedKeys != Statement.NO_GENERATED_KEYS)< ((AbstractJdbc3Statement)ps).wantsGeneratedKeysAlways = true;<< return ps;—> return prepareStatement(sql);
diff -br postgresql-jdbc-9.3-1102.src/org/postgresql/jdbc3/AbstractJdbc3Statement.java postgresql-jdbc-9.3-1102.src.patched/org/postgresql/jdbc3/AbstractJdbc3Statement.java139,144d138< if (autoGeneratedKeys == Statement.NO_GENERATED_KEYS)< return executeUpdate(sql);<< sql = addReturning(connection, sql, new String[]{”
”}, false);< wantsGeneratedKeysOnce = true;<268,273d261< if (autoGeneratedKeys == Statement.NO_GENERATED_KEYS)< return execute(sql);<< sql = addReturning(connection, sql, new String[]{“*”}, false);< wantsGeneratedKeysOnce = true;<

So far the issue remains unresolved and open, but given the amount of time
that this is already the default behaviour of the PostgreSQL JDBC driver, I
have my doubts if this would actually be resolved in a timely fashion. For
what it’s worth, I’d very much prefer some sort of server side
configuration that would allow me too choose if I actually
want RETURN_GENERATED_KEYS set for my queries to a certain datasource or
not, default could be true so as not to break anything else.

For now I’ll revert to the 8.3 driver until I can find the time to
experiment with rolling my own again, likely incorporating the dirty hack
above.

Kind regards

Markus