Closed amotl closed 1 year ago
We should probably switch to extend from the PGCompiler
instead of the default SQLCompiler
. See https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_4_41/lib/sqlalchemy/dialects/postgresql/base.py#L2394.
CrateDB (like PG) does not support negative LIMIT values.
Wow, thanks for quickly looking that up. My thoughts have been similar, like »let's just take the limit_clause
function from the PostgreSQL dialect?«.
On this matter, I just discovered that LIMIT ALL
is only possible when phrased without OFFSET
.
Works:
cr> SELECT * FROM testdrive WHERE name='John Doe' LIMIT ALL;
Croaks:
cr> SELECT * FROM testdrive WHERE name='John Doe' LIMIT ALL OFFSET 0;
SQLParseException[Invalid LIMIT: value must be >= 0; got: -1]
When looking at the SQLAlchemy code, we can clearly see that it can build such an SQL statement. Please +1 on this comment if you think I should create a corresponding issue at crate/crate.
Edit: Upstream issue and patch:
Problem
Reproduction
Enable the Query multiple records code of
cratedb-dataset-demo.py
and run it.Reason
SQLAlchemy's
compiler.py:limit_clause
implementation: