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/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
This commit is contained in:
Mike Bayer 2018-08-30 17:33:43 -04:00
parent 19859ac6e2
commit e64c6bb697
1 changed files with 4 additions and 4 deletions

View File

@ -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(