summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-08-30 17:33:43 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-08-30 17:52:09 -0400
commite64c6bb6970b61b9f8aa704c5b2ac6e1f9c382d3 (patch)
tree58bd86959f266f250eaa677f424a1f08d81d2494
parent19859ac6e25641558dc9799224bfd9963d434311 (diff)
downloadoslo-db-4.41.1.tar.gz
Fix FOREIGN KEY messages for MariaDB 10.2, 10.34.41.14.41.0
MariaDB 10.2 and 10.3 have changed the format diplayed for MySQL error 1091, adding the phrase "FOREIGN KEY", changing the quoting style of the constraint name, and replacing the phrase "column/key" with the word "it". Adjust the regular expression in exc_filters to accommodate these. - "check that column/key" -> "check that constraint/column/key" https://github.com/MariaDB/server/commit/db7edfed17efe6bc - single quotes -> backticks - "check that constraint/column/key" -> "check that it" https://github.com/MariaDB/server/commit/99e48cb1d94e2d88 - "Can't DROP" -> "Can't DROP FOREIGN KEY" https://github.com/MariaDB/server/commit/5c764a0eb82c87ac Change-Id: I165c595edbbdc101ebd2367ca5680b6cd81eaa7b
-rw-r--r--oslo_db/sqlalchemy/exc_filters.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/oslo_db/sqlalchemy/exc_filters.py b/oslo_db/sqlalchemy/exc_filters.py
index e42718b..65b0319 100644
--- a/oslo_db/sqlalchemy/exc_filters.py
+++ b/oslo_db/sqlalchemy/exc_filters.py
@@ -251,11 +251,11 @@ def _check_constraint_error(
"of relation "
"\"(?P<relation>.+)\" does not exist")
@filters("mysql", sqla_exc.InternalError,
- r".*1091,.*Can't DROP '(?P<constraint>.+)'; "
- "check that column/key exists")
+ r".*1091,.*Can't DROP (?:FOREIGN KEY )?['`](?P<constraint>.+)['`]; "
+ "check that .* exists")
@filters("mysql", sqla_exc.OperationalError,
- r".*1091,.*Can't DROP '(?P<constraint>.+)'; "
- "check that column/key exists")
+ r".*1091,.*Can't DROP (?:FOREIGN KEY )?['`](?P<constraint>.+)['`]; "
+ "check that .* exists")
@filters("mysql", sqla_exc.InternalError,
r".*1025,.*Error on rename of '.+/(?P<relation>.+)' to ")
def _check_constraint_non_existing(