Hi I have one "mysql" query that looks like this:
... WHERE (maintenanceLockTimestamp + "+ delay+" SECOND) < CURRENT_TIMESTAMP ) ) "
The thing is that, we need to move from MYSQL to PostgreSQL, but when executing the same query, I get:
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "SECONDS"
I checked here: https://www.postgresqltutorial.com/postgresql-date-functions/
and it looks like the SECOND function is not present in PostgreSQL, do you know any alternative?
thanks
In Postgres, you can use:
Note the use of a parameter to avoid munging the query string with literal values.
In both databases, this is better written with the date/time arithmetic on the
current_timestamp:This allows the optimizer to use an index on
maintenanceLockTimestampfor performance.