Dropped creation of errcodes with missing spec field

On further inspection these names are just aliases for values already
defined: we don't need the duplication.
This commit is contained in:
Daniele Varrazzo 2014-08-28 02:05:54 +01:00
parent ccc30e1877
commit 6705e4051d
3 changed files with 3 additions and 14 deletions

2
NEWS
View File

@ -22,8 +22,6 @@ What's new in psycopg 2.5.4
(:ticket:`#228`).
- Cursors :sql:`WITH HOLD` can be used in autocommit (:ticket:`#229`).
- Don't ignore silently the `cursor.callproc` argument without a length.
- Added a few errors missing from `~psycopg2.errorcodes`, defined by
PostgreSQL but not documented.
- Make sure the internal `_psycopg.so` module can be imported stand-alone
(to allow modules juggling such as the one described in :ticket:`#201`).
- Fixed memory leak with large objects (regression introduced in 2.5.3).

View File

@ -284,10 +284,6 @@ STATEMENT_COMPLETION_UNKNOWN = '40003'
DEADLOCK_DETECTED = '40P01'
# Class 42 - Syntax Error or Access Rule Violation
UNDEFINED_PSTATEMENT = '26000'
UNDEFINED_CURSOR = '34000'
UNDEFINED_DATABASE = '3D000'
UNDEFINED_SCHEMA = '3F000'
SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION = '42000'
INSUFFICIENT_PRIVILEGE = '42501'
SYNTAX_ERROR = '42601'

View File

@ -72,15 +72,10 @@ def parse_errors_txt(url):
m = re.match(r"(.....)\s+(?:E|W|S)\s+ERRCODE_(\S+)(?:\s+(\S+))?$", line)
if m:
errcode, macro, spec = m.groups()
# error 22008 has 2 macros and 1 def: give priority to the def
# as it's the one we used to parse from sgml
# skip errcodes without specs as they are not publically visible
if not spec:
if errcode in errors[class_]:
continue
errlabel = macro.upper()
else:
errlabel = spec.upper()
continue
errlabel = spec.upper()
errors[class_][errcode] = errlabel
continue