]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Support indexing on expressions and functions for the MySQL dialect
authorRamonWill <ramonwilliams@hotmail.co.uk>
Wed, 16 Sep 2020 21:47:21 +0000 (17:47 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 12 Oct 2020 21:28:43 +0000 (17:28 -0400)
commit846f0176485e215f4f04827e6490859e670ce0ab
tree83bd9a2446a8389bd8c9b613200f5003795a1137
parent1826fd9c1acae6504870b0afcde371da652f0d3d
Support indexing on expressions and functions for the MySQL dialect

A user noticed that creating an index where the "key part" was an expression
or function would raise an error for MySQL because the key part was not
parenthesized. The proposed change will check whether a key part is not a
Column or Unary Expression  and parenthesize if the case is False.

This fix also contains a minor fix to a test case that was previously incorrect
(`def test_create_index_expr():`).

**Have a nice day!**
Fixes: #5462
Closes: #5587
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5587
Pull-request-sha: 7515e50cd7435744fc79c210b2f3aa4c0546ba28

Change-Id: Id1b3b3026983c0e05808baa243e354f82b78180c
(cherry picked from commit 9dedf37446108196b585ffdcef8dd48c378d1401)
doc/build/changelog/unreleased_13/5462.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
test/dialect/mysql/test_compiler.py