From f1461d2d7ed1beff28c37d24b02d4e35c81b2d83 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 19 Oct 2017 02:16:27 +0100 Subject: [PATCH] Parse PG 10 error codes from final version --- doc/src/errorcodes.rst | 2 +- scripts/make_errorcodes.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/src/errorcodes.rst b/doc/src/errorcodes.rst index ed40b1f1..f5f2fa8a 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 73aeed9b..1769ba5a 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)