Skip to content
Advertisement

PSQLException: ERROR: syntax error at or near “.”

I’m using Java 8, Spring Boot, and PostgreSQL.

I have the following query

JavaScript

and it is giving me an error PSQLException: ERROR: syntax error at or near "."

I can’t seem to figure out what is causing this. It does not appear to be any reserved words.

Edit

So I turned on debug logs and got this executed SQL. It looks like it’s not liking my and (:searchStr in (mc.tags). mc.tags appears to just be returning a (.). I’m guessing this is because of the fact that tags is a list of objects, not just strings.

I’m trying to match the searchStr on the “name” field of the tags. Any ideas on how to achieve this?

JavaScript

Edit 2

I resolved this with the following code. The answer provided on this question partially resolved it by finding a missing space on a line break. The comments on my question helped point me in the right direction of some joins.

JavaScript

Advertisement

Answer

  1. concat only takes two arguments You can use the || operator instead of concat function, but that’s personal preference.
  2. you’re missing a space at the end of the second to the last line (mc.levels)"+
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement