Project

General

Profile

« Previous | Next » 

Revision 2493

sql.py: run_query(): Exception parsing: Use "(.+?)" wherever possible to match names containing special chars

View differences:

sql.py
371 371
            msg = exc.str_(e)
372 372
            
373 373
            match = re.search(r'duplicate key value violates unique constraint '
374
                r'"((_?[^\W_]+)_[^"]+?)"', msg)
374
                r'"((_?[^\W_]+)_.+?)"', msg)
375 375
            if match:
376 376
                constraint, table = match.groups()
377 377
                try: cols = index_cols(db, table, constraint)
378 378
                except NotImplementedError: raise e
379 379
                else: raise DuplicateKeyException(constraint, cols, e)
380 380
            
381
            match = re.search(r'null value in column "(\w+?)" violates not-null'
381
            match = re.search(r'null value in column "(.+?)" violates not-null'
382 382
                r' constraint', msg)
383 383
            if match: raise NullValueException('NOT NULL', [match.group(1)], e)
384 384
            
385 385
            match = re.search(r'\b(?:invalid input (?:syntax|value)\b.*?'
386 386
                r'|date/time field value out of range): "(.+?)"\n'
387
                r'(?:(?s).*?)\bfunction "(\w+?)".*?\bat assignment', msg)
387
                r'(?:(?s).*?)\bfunction "(.+?)".*?\bat assignment', msg)
388 388
            if match:
389 389
                value, name = match.groups()
390 390
                raise FunctionValueException(name, strings.to_unicode(value), e)
391 391
            
392
            match = re.search(r'relation "(\w+?)" already exists', msg)
392
            match = re.search(r'relation "(.+?)" already exists', msg)
393 393
            if match: raise DuplicateTableException(match.group(1), e)
394 394
            
395
            match = re.search(r'function "(\w+?)" already exists', msg)
395
            match = re.search(r'function "(.+?)" already exists', msg)
396 396
            if match: raise DuplicateFunctionException(match.group(1), e)
397 397
            
398 398
            raise # no specific exception raised

Also available in: Unified diff