PSQLException "invalid input syntax for type timestamp" calling proletarian.db/get-next-job
I have a handful of queues running and every few days one of them will throw this exception:
#error {
:cause "ERROR: invalid input syntax for type timestamp: \"2025-04-29 09:32:48.+00\"\n Where: unnamed portal parameter $2 = '...'"
:via
[{:type org.postgresql.util.PSQLException
:message "ERROR: invalid input syntax for type timestamp: \"2025-04-29 09:32:48.+00\"\n Where: unnamed portal parameter $2 = '...'"
:at [org.postgresql.core.v3.QueryExecutorImpl receiveErrorResponse "QueryExecutorImpl.java" 2422]}]
:trace
[[org.postgresql.core.v3.QueryExecutorImpl receiveErrorResponse "QueryExecutorImpl.java" 2422]
[org.postgresql.core.v3.QueryExecutorImpl processResults "QueryExecutorImpl.java" 2167]
[org.postgresql.core.v3.QueryExecutorImpl execute "QueryExecutorImpl.java" 306]
[org.postgresql.jdbc.PgStatement executeInternal "PgStatement.java" 441]
[org.postgresql.jdbc.PgStatement execute "PgStatement.java" 365]
[org.postgresql.jdbc.PgPreparedStatement executeWithFlags "PgPreparedStatement.java" 155]
[org.postgresql.jdbc.PgPreparedStatement executeQuery "PgPreparedStatement.java" 118]
[com.mchange.v2.c3p0.impl.NewProxyPreparedStatement executeQuery "NewProxyPreparedStatement.java" 353]
[proletarian.db$get_next_job invokeStatic "db.clj" 57]
[proletarian.db$get_next_job invoke "db.clj" 51]
[proletarian.worker$process_next_job_BANG_$fn__35495 invoke "worker.clj" 55]
[proletarian.db$with_tx$fn__35412 invoke "db.clj" 140]
[proletarian.db$with_connection invokeStatic "db.clj" 130]
[proletarian.db$with_connection invoke "db.clj" 128]
[proletarian.db$with_tx invokeStatic "db.clj" 133]
[proletarian.db$with_tx invoke "db.clj" 132]
[proletarian.worker$process_next_job_BANG_ invokeStatic "worker.clj" 53]
[proletarian.worker$process_next_job_BANG_ invoke "worker.clj" 15]
[proletarian.worker$process_next_jobs_BANG_ invokeStatic "worker.clj" 88]
[proletarian.worker$process_next_jobs_BANG_ invoke "worker.clj" 80]
[proletarian.worker$create_queue_worker$reify__35513$work_BANG___35519 invoke "worker.clj" 233]
[clojure.core$partial$fn__5908 invoke "core.clj" 2640]
[clojure.lang.AFn run "AFn.java" 22]
[java.util.concurrent.Executors$RunnableAdapter call "Executors.java" 539]
[java.util.concurrent.FutureTask runAndReset "FutureTask.java" 305]
[java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask run "ScheduledThreadPoolExecutor.java" 305]
[java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1136]
[java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 635]
[java.lang.Thread run "Thread.java" 840]]}
The function I'm passing to :proletarian/on-polling-error returns a falsy value so it's not bringing down the queue but I'm not sure how to avoid the error.
I'm having a hard time reproducing the error. It seems to me that the timestamp is not formatted correctly: 2025-04-29 09:32:48.+00 is not a valid ISO timestamp. I don't know how that could be produced. I've tried (get-next-job) locally with an Instant that represent that timestamp ((Instant/parse "2025-04-29T09:32:48Z")), but I don't get the error.
Maybe it's some sort of library version or Postgres version issue? Can you post the Postgres server version, and the actual version of org.postgresql/postgresql that your app uses?
If you pull in Proletarian from main, it's been updated with the latest version of the Postgres JDBC driver. You can try upgrading to that and see if it helps?
Let me know if you still have problems, and I can have a look. Closing this for now.