From 279d185058ecf322b0c7a1fc8263dbf4da56e9b7 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 5 Apr 2021 16:32:14 -0400 Subject: uniquify when popping literal_execute_params from param dict Fixed further issues in the same area as that of :ticket:`6173` released in 1.4.5, where a "postcompile" parameter, again most typically those used for LIMIT/OFFSET rendering in Oracle and SQL Server, would fail to be processed correctly if the same parameter rendered in multiple places in the statement. Fixes: #6202 Change-Id: I95c355aa52a7546fe579ad67f9a8402a213cb79d --- lib/sqlalchemy/testing/suite/test_select.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/sqlalchemy/testing/suite') diff --git a/lib/sqlalchemy/testing/suite/test_select.py b/lib/sqlalchemy/testing/suite/test_select.py index c519154f6..7318a4f33 100644 --- a/lib/sqlalchemy/testing/suite/test_select.py +++ b/lib/sqlalchemy/testing/suite/test_select.py @@ -223,6 +223,20 @@ class FetchLimitOffsetTest(fixtures.TablesTest): [(1, 1, 2), (2, 2, 3), (3, 3, 4)], ) + def test_limit_render_multiple_times(self, connection): + table = self.tables.some_table + stmt = select(table.c.id).limit(1).scalar_subquery() + + u = union(select(stmt), select(stmt)).subquery().select() + + self._assert_result( + connection, + u, + [ + (1,), + ], + ) + @testing.requires.fetch_first def test_simple_fetch(self, connection): table = self.tables.some_table -- cgit v1.2.1