druid postgresql limit clause 不支持只有offset字段场景

ws51t4hk  于 2022-10-27  发布在  Druid
关注(0)|答案(1)|浏览(218)
assertDoesNotThrow(()->{
            try {
                PGSQLStatementParser parser = new PGSQLStatementParser("select tenant_id from operations where (operation = 'NEW' or operation = 'DELETE') offset ?");
                SQLStatement statement = parser.parseStatement();
                statement.toLowerCaseString();
            } catch (Exception e) {
                throw e;
            }
        });

select tenant_id from operations where (operation = 'NEW' or operation = 'DELETE') offset ? 是一个合理的postgresql sql, 但是PGSQLStatementParser 之后会抛异常

7.6. LIMIT and OFFSET
LIMIT and OFFSET allow you to retrieve just a portion of the rows that are generated by the rest of the query:

SELECT select_list
FROM table_expression
[ ORDER BY ... ]
[ LIMIT { number | ALL } ] [ OFFSET number ]

相关问题