I can't get the following request to work with Play framework
SELECT DISTINCT tableName
FROM hand
WHERE (hand.userLogin = {userLogin} OR {userLogin} IS NULL)
AND (date >= now() - interval '3 days')
ORDER BY tableName
I tested it on a PostreSQL database and it works perfectly, however when I try to run in in dev mode it does not work, I get the following error:
Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT DISTINCT TABLENAME FROM HAND WHERE (HAND.USERLOGIN = ? OR ? IS NULL) AND (DATE >= CURRENT_TIMESTAMP - INTERVAL '3 minute'[*]) ORDER BY TABLENAME "; expected "., (, [, ::, *, /, %, +, -, ||, ~, !~, (, NOT, LIKE, REGEXP, IS, IN, BETWEEN, AND, OR, ,, )";
my conf file says:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play;MODE=PostgreSQL"
I don't know what I am getting wrong. Removing the interval part makes it work so it is obviously the problem.
Postgres interval does not belong to H2 standard, thus it is not supported by H2. See h2 grammar doc for supported functions and keywords.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With