diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-03-22 11:56:04 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-03-22 11:56:04 -0400 |
| commit | d856f640b5803d52fa702a750e504990e80d8724 (patch) | |
| tree | 0a53facf650c521086333dbf380d6f59a4aae777 /lib/sqlalchemy/sql | |
| parent | ce4e1770f01a6c19d3a55621529e3f98607d7824 (diff) | |
| download | sqlalchemy-d856f640b5803d52fa702a750e504990e80d8724.tar.gz | |
use clone, not constructor, in BindParameter.render_literal_execute()
Fixed issue where the :meth:`_sql.BindParameter.render_literal_execute`
method would fail when called on a parameter that also had ORM annotations
associated with it. In practice, this would be observed as a failure of SQL
compilation when using some combinations of a dialect that uses "FETCH
FIRST" such as Oracle along with a :class:`_sql.Select` construct that uses
:meth:`_sql.Select.limit`, within some ORM contexts, including if the
statement were embedded within a relationship primaryjoin expression.
Fixes: #9526
Change-Id: I2f512b6760a90293d274e60b06a891f10b276ecc
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/elements.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index ef4587e18..8bf834d11 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -2057,12 +2057,9 @@ class BindParameter(roles.InElementRole, KeyedColumnElement[_T]): :ref:`engine_thirdparty_caching` """ - return self.__class__( - self.key, - self.value, - type_=self.type, - literal_execute=True, - ) + c = ClauseElement._clone(self) + c.literal_execute = True + return c def _negate_in_binary(self, negated_op, original_op): if self.expand_op is original_op: |
