Project

General

Profile

« Previous | Next » 

Revision 3346

sql.py: Added ConstraintException and parse it in run_query()

View differences:

lib/sql.py
76 76

  
77 77
class NullValueException(ConstraintException): pass
78 78

  
79
class CheckException(ConstraintException): pass
80

  
79 81
class InvalidValueException(ExceptionWithValue): pass
80 82

  
81 83
class DuplicateException(ExceptionWithNameType): pass
......
523 525
                col, = match.groups()
524 526
                raise NullValueException('NOT NULL', None, [col], e)
525 527
            
528
            match = re.match(r'^new row for relation "(.+?)" violates check '
529
                r'constraint "(.+?)"', msg)
530
            if match:
531
                table, constraint = match.groups()
532
                raise CheckException(constraint, None, [], e)
533
            
526 534
            match = re.match(r'^(?:invalid input (?:syntax|value)\b.*?'
527 535
                r'|.+? field value out of range): "(.+?)"', msg)
528 536
            if match:

Also available in: Unified diff