I am using JDBC from Scala using ScalikeJDBC library.
Let's take a simple query: UPDATE "test_table" SET "test" = 1234 WHERE ("asdad" is null)
If I pass this query directly to psql
or execute it raw via JDBC everything works fine. But if I try to pass the null
as a parameter, I get the following error: org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1"
I pass the null
value like this:
session.update("""UPDATE "test_table" SET "test" = 1234 WHERE ("asdad" is ?)""", null)
The ?
placeholder gets automatically converted to $1
by ScalikeJDBC library. The executed query is shown in Scala console:
UPDATE "test_table" SET "test" = 1234 WHERE ("asdad" is null)
Thanks!