gimlet icon indicating copy to clipboard operation
gimlet copied to clipboard

Executing a non-root query with manual input throws exception with PostgreSQL

Open krpors opened this issue 4 years ago • 1 comments

See title. When connecting to a PostgreSQL database and executing a non-root query (with some manual input), an exception gets thrown.

krpors avatar Jul 18 '20 20:07 krpors

Stack trace follows:

ERROR: operator does not exist: integer = character varying
  Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
  Position: 42

Source query:

select * from permit_type pt where pt.id = :permit_type_id;

Named parameters given:

	permit_type_id = 5

Stacktrace:

org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying
  Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
  Position: 42
	at [email protected]/org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2532)
	at [email protected]/org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2267)
	at [email protected]/org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:312)
	at [email protected]/org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:448)
	at [email protected]/org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369)
	at [email protected]/org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:153)
	at [email protected]/org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:103)
	at gimlet/cruft.wtf.gimlet.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:55)
	at gimlet/cruft.wtf.gimlet.jdbc.task.QueryTask.call(QueryTask.java:110)
	at gimlet/cruft.wtf.gimlet.jdbc.task.QueryTask.call(QueryTask.java:21)
	at javafx.graphics/javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.lang.Thread.run(Thread.java:834)

krpors avatar Aug 11 '20 15:08 krpors