Browse Source

Fix FOREIGN KEY messages for MariaDB 10.2, 10.3

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/db7edfed17

- single quotes -> backticks
- "check that constraint/column/key" ->
  "check that it"
https://github.com/MariaDB/server/commit/99e48cb1d9

- "Can't DROP" -> "Can't DROP FOREIGN KEY"
https://github.com/MariaDB/server/commit/5c764a0eb8

Change-Id: I165c595edbbdc101ebd2367ca5680b6cd81eaa7b
Mike Bayer 7 months ago
parent
commit
e64c6bb697
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      oslo_db/sqlalchemy/exc_filters.py

+ 4
- 4
oslo_db/sqlalchemy/exc_filters.py View File

@@ -251,11 +251,11 @@ def _check_constraint_error(
251 251
          "of relation "
252 252
          "\"(?P<relation>.+)\" does not exist")
253 253
 @filters("mysql", sqla_exc.InternalError,
254
-         r".*1091,.*Can't DROP '(?P<constraint>.+)'; "
255
-         "check that column/key exists")
254
+         r".*1091,.*Can't DROP (?:FOREIGN KEY )?['`](?P<constraint>.+)['`]; "
255
+         "check that .* exists")
256 256
 @filters("mysql", sqla_exc.OperationalError,
257
-         r".*1091,.*Can't DROP '(?P<constraint>.+)'; "
258
-         "check that column/key exists")
257
+         r".*1091,.*Can't DROP (?:FOREIGN KEY )?['`](?P<constraint>.+)['`]; "
258
+         "check that .* exists")
259 259
 @filters("mysql", sqla_exc.InternalError,
260 260
          r".*1025,.*Error on rename of '.+/(?P<relation>.+)' to ")
261 261
 def _check_constraint_non_existing(

Loading…
Cancel
Save