diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-05-10 12:49:56 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-05-10 12:57:08 -0400 |
| commit | 40b0e4b424c87adedfdf3bf968f3ee6851743fc2 (patch) | |
| tree | 80fefa8f93e46a56307e31bdc55d615432c24268 /lib/sqlalchemy/sql | |
| parent | a9f74400b179e9d19e073a2a1e43cbffda6e1fad (diff) | |
| download | sqlalchemy-40b0e4b424c87adedfdf3bf968f3ee6851743fc2.tar.gz | |
Fix label referencing in SQL Server OFFSET logic
Fixed bug where by ROW_NUMBER OVER clause applied for OFFSET
selects in SQL Server would inappropriately substitute a plain column
from the local statement that overlaps with a label name used by
the ORDER BY criteria of the statement.
Change-Id: Ic2500c886cbfc83a1ad5a2681783f008b9f23838
Fixes: #3711
(cherry picked from commit a4be7c92393e08607dc46f318e97803519052a93)
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/util.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 16a1421f6..665814f84 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -173,6 +173,16 @@ def unwrap_order_by(clause): return cols +def unwrap_label_reference(element): + def replace(elem): + if isinstance(elem, (_label_reference, _textual_label_reference)): + return elem.element + + return visitors.replacement_traverse( + element, {}, replace + ) + + def clause_is_present(clause, search): """Given a target clause and a second to search within, return True if the target is plainly present in the search without any |
