Revision 9457
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sql.py | ||
---|---|---|
598 | 598 |
name, type_ = match.groups() |
599 | 599 |
raise InvalidTypeException(type_, name, e) |
600 | 600 |
|
601 |
typed_name_re = r'^(\S+) (?:"([^"]*)"|(\S+))(?: of relation ".+?")?' |
|
601 |
typed_name_re = r'^(\S+) "(.+?)"(?: of relation ".+?")?' |
|
602 |
# regexp must be followed with text for .*? to match properly |
|
602 | 603 |
|
603 | 604 |
match = re.match(typed_name_re+r'.*? already exists', msg) |
604 | 605 |
if match: |
605 |
type_, name_quoted, name_unquoted = match.groups() |
|
606 |
name = util.coalesce(name_quoted, name_unquoted, u'') |
|
606 |
type_, name = match.groups() |
|
607 | 607 |
raise DuplicateException(type_, name, e) |
608 | 608 |
|
609 | 609 |
match = re.match(r'more than one (\S+) named ""(.+?)""', msg) |
... | ... | |
613 | 613 |
|
614 | 614 |
match = re.match(typed_name_re+r' does not exist', msg) |
615 | 615 |
if match: |
616 |
type_, name_quoted, name_unquoted = match.groups() |
|
617 |
name = util.coalesce(name_quoted, name_unquoted, u'') |
|
616 |
type_, name = match.groups() |
|
618 | 617 |
if type_ == 'function': |
619 | 618 |
match = re.match(r'^(.+?)\(.*\)$', name) |
620 | 619 |
if match: # includes params, so is call rather than cast to regproc |
Also available in: Unified diff
bugfix: lib/sql.py: parse_exception(): typed_name_re: need to allow " within the matched name, since there are now "" around the entire identifer that was passed to Postgres, which may itself include " . always require "" around the matched name, to ensure that the whole name is matched by .+? e.g. when followed by () for a function call. the version of Postgres we currently use apparently no longer has error messages without the "", so we don't need a separate regexp for quoted and unquoted names.