datamapper/do — pull request #31 by jwkoelewijn (2012-05-10 13:00:27+00:00)
Title: Fixed problem with Postgres 9.1 Writeable CTE's

Problem solved by rewriting code that checked whether the
query should be executed using PreparedStatement#executeQuery() or
using PreparedStatement#executeUpdate().
Original code checked for the existence of the word 'RETURNING',
where this is perfectly possible in Postgres 9.1, where a writable
CTE can be created with the word RETURNING in it, while not actually
returning any values (i.e. #executeQuery() should have been called)

Fix is to use the PreparedStatement#execute(), which returns a
boolean that indicates whether a result was returned, or that
existing rows were affected. Based on the value of this boolean
either a ResultSet is requested or the number of affected rows
is retrieved.