diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-11-09 16:12:30 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-11-09 16:12:30 -0500 |
| commit | b3c3562ecf67ae7c94091287504579fcace6a500 (patch) | |
| tree | a3e6a37d22f9ff239264d0a10ebf41c91358f3ae /lib/sqlalchemy/dialects | |
| parent | ed2c5f9ad1f92010e447797576ab4eef3beee21f (diff) | |
| download | sqlalchemy-b3c3562ecf67ae7c94091287504579fcace6a500.tar.gz | |
Interpret empty LIMIT, expression LIMIT correctly
Fixed issue in MSSQL dialect where an expression-based OFFSET value in a
SELECT would be rejected, even though the dialect can render this
expression inside of a ROW NUMBER-oriented LIMIT/OFFSET construct.
Fixes: #4973
Change-Id: I040d34f781791c4ed5a727e1b8fb98c68ddd0622
Diffstat (limited to 'lib/sqlalchemy/dialects')
| -rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 5d4de4a33..261ebe5c2 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1612,7 +1612,10 @@ class MSSQLCompiler(compiler.SQLCompiler): if select._distinct: s += "DISTINCT " - if select._simple_int_limit and not select._offset: + if select._simple_int_limit and ( + select._offset_clause is None + or (select._simple_int_offset and select._offset == 0) + ): # ODBC drivers and possibly others # don't support bind params in the SELECT clause on SQL Server. # so have to use literal here. |
