]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Turn off the is_literal flag when proxying literal_column() to Label
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 15 Jun 2019 22:06:50 +0000 (18:06 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 16 Jun 2019 00:38:39 +0000 (20:38 -0400)
commit009acc95b8804b5b62fbd43c6fdd61d6fd407ef7
treeb6e8d799be87d73b3f981c7a876b8c22a18809d4
parentde08740d7c21fa9dcef453bfd07a3defa428e88f
Turn off the is_literal flag when proxying literal_column() to Label

Fixed a series of quoting issues which all stemmed from the concept of the
:func:`.literal_column` construct, which when being "proxied" through a
subquery to be referred towards by a label that matches its text, the label
would not have quoting rules applied to it, even if the string in the
:class:`.Label` were set up as a :class:`.quoted_name` construct.  Not
applying quoting to the text of the :class:`.Label` is a bug because this
text is strictly a SQL identifier name and not a SQL expression, and the
string should not have quotes embedded into it already unlike the
:func:`.literal_column` which it may be applied towards.   The existing
behavior of a non-labeled :func:`.literal_column` being propagated as is on
the outside of a subquery is maintained in order to help with manual
quoting schemes, although it's not clear if valid SQL can be generated for
such a construct in any case.

Fixes: #4730
Change-Id: I300941f27872fc4298c74a1d1ed65aef1a5cdd82
doc/build/changelog/unreleased_13/4730.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/selectable.py
test/dialect/oracle/test_compiler.py
test/sql/test_quote.py
test/sql/test_text.py