cubicweb/server/sources/native.py
changeset 12614 8ac9ac8d9143
parent 12591 f5f83d72ba8d
child 12731 8e5f2c449e60
--- a/cubicweb/server/sources/native.py	Thu May 16 09:40:28 2019 +0200
+++ b/cubicweb/server/sources/native.py	Thu May 16 04:42:59 2019 +0200
@@ -716,14 +716,17 @@
                     mo = re.search(r'\bcstr[a-f0-9]{32}\b', arg)
                     if mo is not None:
                         # postgresql
-                        raise ViolatedConstraint(cnx, cstrname=mo.group(0))
+                        raise ViolatedConstraint(cnx, cstrname=mo.group(0),
+                                                 query=query)
                     if arg.startswith('CHECK constraint failed:'):
                         # sqlite3 (new)
-                        raise ViolatedConstraint(cnx, cstrname=arg.split(':', 1)[1].strip())
+                        raise ViolatedConstraint(cnx, cstrname=arg.split(':', 1)[1].strip(),
+                                                 query=query)
                     mo = re.match('^constraint (cstr.*) failed$', arg)
                     if mo is not None:
                         # sqlite3 (old)
-                        raise ViolatedConstraint(cnx, cstrname=mo.group(1))
+                        raise ViolatedConstraint(cnx, cstrname=mo.group(1),
+                                                 query=query)
             raise
         return cursor