我无法使用Play框架使以下请求正常工作。
我在PostgreSQL数据库上测试了它,并且它完美地工作了。但是,当我尝试在dev模式下运行时,它无法正常工作,我会得到以下错误:
Caused by: org.h2.jdbc.JdbcSQLException: SQL语句中的语法错误 "SELECT DISTINCT TABLENAME FROM HAND WHERE (HAND.USERLOGIN = ? OR ? IS NULL) AND (DATE >= CURRENT_TIMESTAMP - INTERVAL '3 minute'[*]) ORDER BY TABLENAME "; 期望 "., (, [, ::, *, /, %, +, -, ||, ~, !~, (, NOT, LIKE, REGEXP, IS, IN, BETWEEN, AND, OR, ,, )";
我的配置文件如下:
SELECT DISTINCT tableName
FROM hand
WHERE (hand.userLogin = {userLogin} OR {userLogin} IS NULL)
AND (date >= now() - interval '3 days')
ORDER BY tableName
我在PostgreSQL数据库上测试了它,并且它完美地工作了。但是,当我尝试在dev模式下运行时,它无法正常工作,我会得到以下错误:
Caused by: org.h2.jdbc.JdbcSQLException: SQL语句中的语法错误 "SELECT DISTINCT TABLENAME FROM HAND WHERE (HAND.USERLOGIN = ? OR ? IS NULL) AND (DATE >= CURRENT_TIMESTAMP - INTERVAL '3 minute'[*]) ORDER BY TABLENAME "; 期望 "., (, [, ::, *, /, %, +, -, ||, ~, !~, (, NOT, LIKE, REGEXP, IS, IN, BETWEEN, AND, OR, ,, )";
我的配置文件如下:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play;MODE=PostgreSQL"
我不知道我做错了什么。 去掉间隔部分后,它可以工作,显然这是问题的原因。
SELECT DISTINCT tableName FROM hand WHERE date >= DATESUB('MINUTE', 3, NOW()) ORDER BY tableName
- BentayeSELECT DISTINCT tableName FROM hang WHERE date >= DATE_SUB(NOW(), INTERVAL 3 MINUTE);
- Mon Calamari