summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-11-26 12:10:25 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-11-26 12:21:22 -0500
commit6125dfff91ca0093a00d78804917240617825c44 (patch)
tree928cd035b4b000b41eac72aa300957cec56626bf /lib/sqlalchemy/sql/util.py
parent2759eefbf32862be464ecd5b1e91163c7773df39 (diff)
downloadsqlalchemy-6125dfff91ca0093a00d78804917240617825c44.tar.gz
Don't discard leftovers from surface_selectables
Fixed regression introduced in 1.3.2 for the PostgreSQL dialect, also copied out to the MySQL dialect's feature in 1.3.18, where usage of a non :class:`_schema.Table` construct such as :func:`_sql.text` as the argument to :paramref:`_sql.Select.with_for_update.of` would fail to be accommodated correctly within the PostgreSQL or MySQL compilers. Fixes: #5729 Change-Id: I265bcc171f0eb865ac3910ee805b162f3b70e2c1
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r--lib/sqlalchemy/sql/util.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py
index 1bea97318..55c17a193 100644
--- a/lib/sqlalchemy/sql/util.py
+++ b/lib/sqlalchemy/sql/util.py
@@ -401,7 +401,12 @@ def surface_selectables_only(clause):
elif isinstance(elem, FromGrouping):
stack.append(elem.element)
elif isinstance(elem, ColumnClause):
- stack.append(elem.table)
+ if elem.table is not None:
+ stack.append(elem.table)
+ else:
+ yield elem
+ elif elem is not None:
+ yield elem
def extract_first_column_annotation(column, annotation_name):