Errors mapping updated to PostgreSQL 13

This commit is contained in:
Daniele Varrazzo 2020-09-05 20:24:19 +01:00
parent c203d681c4
commit dd1724c447
7 changed files with 10 additions and 4 deletions

2
NEWS
View File

@ -8,6 +8,8 @@ What's new in psycopg 2.8.6
(:ticket:`#1101`).
- Fixed search of mxDateTime headers in virtualenvs (:ticket:`#996`).
- Added missing values from errorcodes (:ticket:`#1133`).
- `~psycopg2.errorcodes` map and `~psycopg2.errors` classes updated to
PostgreSQL 13.
- Wheel package compiled against OpenSSL 1.1.1g.

View File

@ -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 12 are included in the module.
between 8.1 and 13 are included in the module.
.. autofunction:: lookup(code)

View File

@ -12,11 +12,13 @@
.. versionchanged:: 2.8.4 added errors introduced in PostgreSQL 12
.. versionchanged:: 2.8.6 added errors introduced in PostgreSQL 13
This module exposes the classes psycopg raises upon receiving an error from
the database with a :sql:`SQLSTATE` value attached (available in the
`~psycopg2.Error.pgcode` attribute). The content of the module is generated
from the PostgreSQL source code and includes classes for every error defined
by PostgreSQL in versions between 9.1 and 12.
by PostgreSQL in versions between 9.1 and 13.
Every class in the module is named after what referred as "condition name" `in
the documentation`__, converted to CamelCase: e.g. the error 22012,

View File

@ -208,6 +208,7 @@ ARRAY_SUBSCRIPT_ERROR = '2202E'
INVALID_TABLESAMPLE_REPEAT = '2202G'
INVALID_TABLESAMPLE_ARGUMENT = '2202H'
DUPLICATE_JSON_OBJECT_KEY_VALUE = '22030'
INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION = '22031'
INVALID_JSON_TEXT = '22032'
INVALID_SQL_JSON_SUBSCRIPT = '22033'
MORE_THAN_ONE_SQL_JSON_ITEM = '22034'

View File

@ -96,6 +96,7 @@
{"2202G", "InvalidTablesampleRepeat"},
{"2202H", "InvalidTablesampleArgument"},
{"22030", "DuplicateJsonObjectKeyValue"},
{"22031", "InvalidArgumentForSqlJsonDatetimeFunction"},
{"22032", "InvalidJsonText"},
{"22033", "InvalidSqlJsonSubscript"},
{"22034", "MoreThanOneSqlJsonItem"},

View File

@ -34,7 +34,7 @@ def main():
file_start = read_base_file(filename)
# If you add a version to the list fix the docs (in errorcodes.rst)
classes, errors = fetch_errors(
['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11', '12'])
['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11', '12', '13'])
disambiguate(errors)

View File

@ -31,7 +31,7 @@ def main():
# If you add a version to the list fix the docs (in errors.rst)
classes, errors = fetch_errors(
['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11', '12'])
['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11', '12', '13'])
f = open(filename, "w")
print("/*\n * Autogenerated by 'scripts/make_errors.py'.\n */\n", file=f)