Fixed compiler issue in the PostgreSQL dialect where incorrect keywords
would be passed when using "FOR UPDATE OF" inside of a subquery.
Fixes: #12417
Change-Id: I6255d165e8e719e1786e78aa60ee8e6a95af1dcb
(cherry picked from commit
21630d2574328a0f01a1e994e264f56f1adf99db)
--- /dev/null
+.. change::
+ :tags: bug, postgresql
+ :tickets: 12417
+
+ Fixed compiler issue in the PostgreSQL dialect where incorrect keywords
+ would be passed when using "FOR UPDATE OF" inside of a subquery.
for c in select._for_update_arg.of:
tables.update(sql_util.surface_selectables_only(c))
+ of_kw = dict(kw)
+ of_kw.update(ashint=True, use_schema=False)
tmp += " OF " + ", ".join(
- self.process(table, ashint=True, use_schema=False, **kw)
- for table in tables
+ self.process(table, **of_kw) for table in tables
)
if select._for_update_arg.nowait:
"FOR UPDATE OF table1",
)
+ # test issue #12417
+ subquery = select(table1.c.myid).with_for_update(of=table1).lateral()
+ statement = select(subquery.c.myid)
+ self.assert_compile(
+ statement,
+ "SELECT anon_1.myid FROM LATERAL (SELECT mytable.myid AS myid "
+ "FROM mytable FOR UPDATE OF mytable) AS anon_1",
+ )
+
def test_for_update_with_schema(self):
m = MetaData()
table1 = Table(