diff options
Diffstat (limited to 'oslo/db')
-rw-r--r-- | oslo/db/sqlalchemy/exc_filters.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/oslo/db/sqlalchemy/exc_filters.py b/oslo/db/sqlalchemy/exc_filters.py index c03c4b4..b3da401 100644 --- a/oslo/db/sqlalchemy/exc_filters.py +++ b/oslo/db/sqlalchemy/exc_filters.py @@ -169,7 +169,7 @@ def _sqlite_dupe_key_error(integrity_error, match, engine_name, is_disconnect): @filters("sqlite", sqla_exc.IntegrityError, - r".*SQL error: foreign key constraint failed") + r"(?i).*foreign key constraint failed") @filters("postgresql", sqla_exc.IntegrityError, r".*on table \"(?P<table>[^\"]+)\" violates " "foreign key constraint \"(?P<constraint>[^\"]+)\"\s*\n" @@ -177,13 +177,13 @@ def _sqlite_dupe_key_error(integrity_error, match, engine_name, is_disconnect): "is not present in table " "\"(?P<key_table>[^\"]+)\".") @filters("mysql", sqla_exc.IntegrityError, - r".* Cannot add or update a child row: " - "a foreign key constraint fails " - "\((?P<table>.+), CONSTRAINT (?P<constraint>.+) " - "FOREIGN KEY \((?P<key>.+)\) " - "REFERENCES (?P<key_table>.+) \(.+\)\)") + r".* 'Cannot add or update a child row: " + 'a foreign key constraint fails \([`"].+[`"]\.[`"](?P<table>.+)[`"], ' + 'CONSTRAINT [`"](?P<constraint>.+)[`"] FOREIGN KEY ' + '\([`"](?P<key>.+)[`"]\) REFERENCES [`"](?P<key_table>.+)[`"] ') def _foreign_key_error(integrity_error, match, engine_name, is_disconnect): """Filter for foreign key errors.""" + try: table = match.group("table") except IndexError: |