From Sam Macbeth\'s question:
Is there anything in the JDBC spec which allows a ? to be escaped and be anything other than a parameter placeholder?
If you have the latest postgresql driver you can use:
??
Changing the original query:
SELECT * FROM tbl WHERE tbl.data ?? 'abc'
Details are in this pull request - https://github.com/pgjdbc/pgjdbc/pull/227 This change was made long after the original question, but it's worth noting that there's an easy answer now.