diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-17 00:30:29 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-17 00:37:47 -0400 |
commit | 901f7a2b534e4bbc88d7c6894541223cb0dd968d (patch) | |
tree | 6a647d3a18a771855d876a6c358fd9241213a219 /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | b73fc8f874da94c9c5b2d94feb6b1b45b7f4f02b (diff) | |
download | sqlalchemy-901f7a2b534e4bbc88d7c6894541223cb0dd968d.tar.gz |
pass asfrom correctly in compilers
Fixed an argument error in the default and PostgreSQL compilers that
would interfere with an UPDATE..FROM or DELETE..FROM..USING statement
that was then SELECTed from as a CTE.
The incorrect pattern was also fixed in the mysql and sybase dialects.
MySQL supports CTEs but not "returning".
Fixes: #6303
Change-Id: Ic94805611a5ec443749fb6b1fd8a1326b0d83ef7
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 0e9968031..47a933479 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -2420,8 +2420,9 @@ class PGCompiler(compiler.SQLCompiler): def update_from_clause( self, update_stmt, from_table, extra_froms, from_hints, **kw ): + kw["asfrom"] = True return "FROM " + ", ".join( - t._compiler_dispatch(self, asfrom=True, fromhints=from_hints, **kw) + t._compiler_dispatch(self, fromhints=from_hints, **kw) for t in extra_froms ) @@ -2429,8 +2430,9 @@ class PGCompiler(compiler.SQLCompiler): self, delete_stmt, from_table, extra_froms, from_hints, **kw ): """Render the DELETE .. USING clause specific to PostgreSQL.""" + kw["asfrom"] = True return "USING " + ", ".join( - t._compiler_dispatch(self, asfrom=True, fromhints=from_hints, **kw) + t._compiler_dispatch(self, fromhints=from_hints, **kw) for t in extra_froms ) |