summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-10-19 02:16:27 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-10-19 02:28:52 +0100
commitf1461d2d7ed1beff28c37d24b02d4e35c81b2d83 (patch)
tree4682c12461310a77251c9f024aca3d543748d1e5
parent582fd95986789ef30c879219ec9b07a7802b05dd (diff)
downloadpsycopg2-f1461d2d7ed1beff28c37d24b02d4e35c81b2d83.tar.gz
Parse PG 10 error codes from final version
-rw-r--r--doc/src/errorcodes.rst2
-rwxr-xr-xscripts/make_errorcodes.py19
2 files changed, 13 insertions, 8 deletions
diff --git a/doc/src/errorcodes.rst b/doc/src/errorcodes.rst
index ed40b1f..f5f2fa8 100644
--- a/doc/src/errorcodes.rst
+++ b/doc/src/errorcodes.rst
@@ -50,7 +50,7 @@ An example of the available constants defined in the module:
'42P01'
Constants representing all the error values defined by PostgreSQL versions
-between 8.1 and 10 beta 1 are included in the module.
+between 8.1 and 10 are included in the module.
.. autofunction:: lookup(code)
diff --git a/scripts/make_errorcodes.py b/scripts/make_errorcodes.py
index 73aeed9..1769ba5 100755
--- a/scripts/make_errorcodes.py
+++ b/scripts/make_errorcodes.py
@@ -32,10 +32,10 @@ def main():
filename = sys.argv[1]
file_start = read_base_file(filename)
- # If you add a version to the list fix the docs (errorcodes.rst, err.rst)
+ # If you add a version to the list fix the docs (in errorcodes.rst)
classes, errors = fetch_errors(
['8.1', '8.2', '8.3', '8.4', '9.0', '9.1', '9.2', '9.3', '9.4', '9.5',
- '9.6', '10 b1'])
+ '9.6', '10'])
f = open(filename, "w")
for line in file_start:
@@ -146,13 +146,18 @@ def fetch_errors(versions):
if tver < (9, 1):
c1, e1 = parse_errors_sgml(errors_sgml_url % version)
else:
- # TODO: move to 10 stable when released.
- if version == '10 b1':
- tag = 'REL_10_BETA1'
- else:
- tag = 'REL%s_STABLE' % version.replace('.', '_')
+ tag = '%s%s_STABLE' % (
+ (tver[0] >= 10 and 'REL_' or 'REL'),
+ version.replace('.', '_'))
c1, e1 = parse_errors_txt(errors_txt_url % tag)
classes.update(c1)
+
+ # TODO: this error was added in PG 10 beta 1 but dropped in the
+ # final release. It doesn't harm leaving it in the file. Check if it
+ # will be added back in PG 11.
+ # https://github.com/postgres/postgres/commit/28e0727076
+ errors['55']['55P04'] = 'UNSAFE_NEW_ENUM_VALUE_USAGE'
+
for c, cerrs in e1.iteritems():
errors[c].update(cerrs)