From 9de57843a3a98555df21b5c5585f8af699d8ec2e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 7 Aug 2021 11:02:59 -0400 Subject: dont qualify literal_binds with literal_execute this appears to be unnecessary and prevents end-user literal_binds case from working. Fixed issue where the ``literal_binds`` compiler flag, as used externally to render bound parameters inline, would fail to work when used with a certain class of parameters known as "literal_execute", which covers things like LIMIT and OFFSET values for dialects where the drivers don't allow a bound parameter, such as SQL Server's "TOP" clause. The issue locally seemed to affect only the MSSQL dialect. Fixes: #6863 Change-Id: Ia74cff5b0107b129a11b9b965883552b2962e449 --- test/sql/test_compiler.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/sql') diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index d270218b2..b150b9f64 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -4449,6 +4449,24 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase): literal_binds=True, ) + def test_render_literal_execute_sent_parameter_literal_binds(self): + """test #6863""" + + stmt = select(table1.c.myid).where( + table1.c.myid == bindparam("foo", 5, literal_execute=True) + ) + eq_ignore_whitespace( + str( + stmt.compile( + compile_kwargs={ + "literal_binds": True, + "literal_execute": True, + } + ) + ), + "SELECT mytable.myid FROM mytable WHERE mytable.myid = 5", + ) + def test_render_literal_execute_parameter_render_postcompile(self): self.assert_compile( select(table1.c.myid).where( -- cgit v1.2.1