]> 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:38:34 +0000 (17:38 -0400)
commit1cda8e18bf4e9b36d07b9d54c04e1fe035977064
tree9d7ad74137f096b2c105ccbf7932529d3ad2c83c
parent3fcdb7cca05de3a90c4f3b9f96ae680618a26c41
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
doc/build/changelog/unreleased_13/5462.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
test/dialect/mysql/test_compiler.py