mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
Added Postgres 12 errors
This commit is contained in:
parent
8f11821c17
commit
d5c7ec7ae8
4
NEWS
4
NEWS
|
@ -7,7 +7,9 @@ What's new in psycopg 2.8.4
|
||||||
- Don't swallow keyboard interrupts on connect when a password is specified
|
- Don't swallow keyboard interrupts on connect when a password is specified
|
||||||
in the connection string (:ticket:`#898`).
|
in the connection string (:ticket:`#898`).
|
||||||
- Fixed int overflow for large values in `~psycopg2.extensions.Column.table_oid`
|
- Fixed int overflow for large values in `~psycopg2.extensions.Column.table_oid`
|
||||||
and `~psycopg2.extensions.Column.type_code` (:ticket:`961).
|
and `~psycopg2.extensions.Column.type_code` (:ticket:`961`).
|
||||||
|
- `~psycopg2.errorcodes` map and `~psycopg2.errors` classes updated to
|
||||||
|
PostgreSQL 12.
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.8.3
|
What's new in psycopg 2.8.3
|
||||||
|
|
|
@ -50,7 +50,7 @@ An example of the available constants defined in the module:
|
||||||
'42P01'
|
'42P01'
|
||||||
|
|
||||||
Constants representing all the error values defined by PostgreSQL versions
|
Constants representing all the error values defined by PostgreSQL versions
|
||||||
between 8.1 and 11 are included in the module.
|
between 8.1 and 12 are included in the module.
|
||||||
|
|
||||||
|
|
||||||
.. autofunction:: lookup(code)
|
.. autofunction:: lookup(code)
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
|
|
||||||
.. versionadded:: 2.8
|
.. versionadded:: 2.8
|
||||||
|
|
||||||
|
.. versionchanged:: 2.8.4 added errors introduced in PostgreSQL 12
|
||||||
|
|
||||||
This module exposes the classes psycopg raises upon receiving an error from
|
This module exposes the classes psycopg raises upon receiving an error from
|
||||||
the database with a :sql:`SQLSTATE` value attached (available in the
|
the database with a :sql:`SQLSTATE` value attached (available in the
|
||||||
`~psycopg2.Error.pgcode` attribute). The content of the module is generated
|
`~psycopg2.Error.pgcode` attribute). The content of the module is generated
|
||||||
from the PostgreSQL source code and includes classes for every error defined
|
from the PostgreSQL source code and includes classes for every error defined
|
||||||
by PostgreSQL in versions between 9.1 and 11.
|
by PostgreSQL in versions between 9.1 and 12.
|
||||||
|
|
||||||
Every class in the module is named after what referred as "condition name" `in
|
Every class in the module is named after what referred as "condition name" `in
|
||||||
the documentation`__, converted to CamelCase: e.g. the error 22012,
|
the documentation`__, converted to CamelCase: e.g. the error 22012,
|
||||||
|
|
|
@ -205,6 +205,21 @@ TRIM_ERROR = '22027'
|
||||||
ARRAY_SUBSCRIPT_ERROR = '2202E'
|
ARRAY_SUBSCRIPT_ERROR = '2202E'
|
||||||
INVALID_TABLESAMPLE_REPEAT = '2202G'
|
INVALID_TABLESAMPLE_REPEAT = '2202G'
|
||||||
INVALID_TABLESAMPLE_ARGUMENT = '2202H'
|
INVALID_TABLESAMPLE_ARGUMENT = '2202H'
|
||||||
|
DUPLICATE_JSON_OBJECT_KEY_VALUE = '22030'
|
||||||
|
INVALID_JSON_TEXT = '22032'
|
||||||
|
INVALID_SQL_JSON_SUBSCRIPT = '22033'
|
||||||
|
MORE_THAN_ONE_SQL_JSON_ITEM = '22034'
|
||||||
|
NO_SQL_JSON_ITEM = '22035'
|
||||||
|
NON_NUMERIC_SQL_JSON_ITEM = '22036'
|
||||||
|
NON_UNIQUE_KEYS_IN_A_JSON_OBJECT = '22037'
|
||||||
|
SINGLETON_SQL_JSON_ITEM_REQUIRED = '22038'
|
||||||
|
SQL_JSON_ARRAY_NOT_FOUND = '22039'
|
||||||
|
SQL_JSON_MEMBER_NOT_FOUND = '2203A'
|
||||||
|
SQL_JSON_NUMBER_NOT_FOUND = '2203B'
|
||||||
|
SQL_JSON_OBJECT_NOT_FOUND = '2203C'
|
||||||
|
TOO_MANY_JSON_ARRAY_ELEMENTS = '2203D'
|
||||||
|
TOO_MANY_JSON_OBJECT_MEMBERS = '2203E'
|
||||||
|
SQL_JSON_SCALAR_REQUIRED = '2203F'
|
||||||
FLOATING_POINT_EXCEPTION = '22P01'
|
FLOATING_POINT_EXCEPTION = '22P01'
|
||||||
INVALID_TEXT_REPRESENTATION = '22P02'
|
INVALID_TEXT_REPRESENTATION = '22P02'
|
||||||
INVALID_BINARY_REPRESENTATION = '22P03'
|
INVALID_BINARY_REPRESENTATION = '22P03'
|
||||||
|
|
|
@ -95,6 +95,21 @@
|
||||||
{"2202E", "ArraySubscriptError"},
|
{"2202E", "ArraySubscriptError"},
|
||||||
{"2202G", "InvalidTablesampleRepeat"},
|
{"2202G", "InvalidTablesampleRepeat"},
|
||||||
{"2202H", "InvalidTablesampleArgument"},
|
{"2202H", "InvalidTablesampleArgument"},
|
||||||
|
{"22030", "DuplicateJsonObjectKeyValue"},
|
||||||
|
{"22032", "InvalidJsonText"},
|
||||||
|
{"22033", "InvalidSqlJsonSubscript"},
|
||||||
|
{"22034", "MoreThanOneSqlJsonItem"},
|
||||||
|
{"22035", "NoSqlJsonItem"},
|
||||||
|
{"22036", "NonNumericSqlJsonItem"},
|
||||||
|
{"22037", "NonUniqueKeysInAJsonObject"},
|
||||||
|
{"22038", "SingletonSqlJsonItemRequired"},
|
||||||
|
{"22039", "SqlJsonArrayNotFound"},
|
||||||
|
{"2203A", "SqlJsonMemberNotFound"},
|
||||||
|
{"2203B", "SqlJsonNumberNotFound"},
|
||||||
|
{"2203C", "SqlJsonObjectNotFound"},
|
||||||
|
{"2203D", "TooManyJsonArrayElements"},
|
||||||
|
{"2203E", "TooManyJsonObjectMembers"},
|
||||||
|
{"2203F", "SqlJsonScalarRequired"},
|
||||||
{"22P01", "FloatingPointException"},
|
{"22P01", "FloatingPointException"},
|
||||||
{"22P02", "InvalidTextRepresentation"},
|
{"22P02", "InvalidTextRepresentation"},
|
||||||
{"22P03", "InvalidBinaryRepresentation"},
|
{"22P03", "InvalidBinaryRepresentation"},
|
||||||
|
@ -254,6 +269,7 @@
|
||||||
{"55006", "ObjectInUse"},
|
{"55006", "ObjectInUse"},
|
||||||
{"55P02", "CantChangeRuntimeParam"},
|
{"55P02", "CantChangeRuntimeParam"},
|
||||||
{"55P03", "LockNotAvailable"},
|
{"55P03", "LockNotAvailable"},
|
||||||
|
{"55P04", "UnsafeNewEnumValueUsage"},
|
||||||
|
|
||||||
/* Class 57 - Operator Intervention */
|
/* Class 57 - Operator Intervention */
|
||||||
{"57000", "OperatorIntervention"},
|
{"57000", "OperatorIntervention"},
|
||||||
|
|
|
@ -33,7 +33,7 @@ def main():
|
||||||
file_start = read_base_file(filename)
|
file_start = read_base_file(filename)
|
||||||
# If you add a version to the list fix the docs (in errorcodes.rst)
|
# If you add a version to the list fix the docs (in errorcodes.rst)
|
||||||
classes, errors = fetch_errors(
|
classes, errors = fetch_errors(
|
||||||
['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11'])
|
['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11', '12'])
|
||||||
|
|
||||||
f = open(filename, "w")
|
f = open(filename, "w")
|
||||||
for line in file_start:
|
for line in file_start:
|
||||||
|
@ -109,12 +109,6 @@ def fetch_errors(versions):
|
||||||
# https://github.com/postgres/postgres/commit/12f87b2c82
|
# https://github.com/postgres/postgres/commit/12f87b2c82
|
||||||
errors['22']['22020'] = 'INVALID_LIMIT_VALUE'
|
errors['22']['22020'] = 'INVALID_LIMIT_VALUE'
|
||||||
|
|
||||||
# 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 12.
|
|
||||||
# https://github.com/postgres/postgres/commit/28e0727076
|
|
||||||
errors['55']['55P04'] = 'UNSAFE_NEW_ENUM_VALUE_USAGE'
|
|
||||||
|
|
||||||
for c, cerrs in e1.items():
|
for c, cerrs in e1.items():
|
||||||
errors[c].update(cerrs)
|
errors[c].update(cerrs)
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ def main():
|
||||||
|
|
||||||
# If you add a version to the list fix the docs (in errors.rst)
|
# If you add a version to the list fix the docs (in errors.rst)
|
||||||
classes, errors = fetch_errors(
|
classes, errors = fetch_errors(
|
||||||
['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11'])
|
['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11', '12'])
|
||||||
|
|
||||||
f = open(filename, "w")
|
f = open(filename, "w")
|
||||||
print("/*\n * Autogenerated by 'scripts/make_errors.py'.\n */\n", file=f)
|
print("/*\n * Autogenerated by 'scripts/make_errors.py'.\n */\n", file=f)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user