mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-29 12:23:42 +03:00
Merge branch 'pg12'
This commit is contained in:
commit
b2a09fb404
2
NEWS
2
NEWS
|
@ -9,6 +9,8 @@ What's new in psycopg 2.8.4
|
||||||
- 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`).
|
||||||
- Fixed building with Python 3.8 (:ticket:`854`).
|
- Fixed building with Python 3.8 (:ticket:`854`).
|
||||||
|
- `~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
|
||||||
|
|
|
@ -16,7 +16,7 @@ How to make a psycopg2 release
|
||||||
$ export VERSION=2.7
|
$ export VERSION=2.7
|
||||||
|
|
||||||
- In the `Travis settings`__ you may want to be sure that the variables
|
- In the `Travis settings`__ you may want to be sure that the variables
|
||||||
``TEST_PAST`` and ``TEST_FUTURE`` are set to a nonzero string to check all
|
``TEST_PAST`` and ``TEST_FUTURE`` are set to 1 to check all
|
||||||
the supported postgres version.
|
the supported postgres version.
|
||||||
|
|
||||||
.. __: https://travis-ci.org/psycopg/psycopg2/settings
|
.. __: https://travis-ci.org/psycopg/psycopg2/settings
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -36,7 +36,7 @@ The current `!psycopg2` implementation supports:
|
||||||
|
|
||||||
- Python version 2.7
|
- Python version 2.7
|
||||||
- Python 3 versions from 3.4 to 3.8
|
- Python 3 versions from 3.4 to 3.8
|
||||||
- PostgreSQL server versions from 7.4 to 11
|
- PostgreSQL server versions from 7.4 to 12
|
||||||
- PostgreSQL client library version from 9.1
|
- PostgreSQL client library version from 9.1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -39,8 +39,20 @@ create () {
|
||||||
|
|
||||||
# install postgres versions not available on the image
|
# install postgres versions not available on the image
|
||||||
if [[ ! -d "${PGDIR}" ]]; then
|
if [[ ! -d "${PGDIR}" ]]; then
|
||||||
wget -O - http://initd.org/psycopg/upload/postgresql/postgresql-${PACKAGE}-$(lsb_release -cs).tar.bz2 \
|
if (( "$VERNUM" >= 904 )); then
|
||||||
| sudo tar xjf - -C /usr/lib/postgresql
|
# A versiou supported by postgres
|
||||||
|
if [[ ! "${apt_updated:-}" ]]; then
|
||||||
|
apt_updated="yeah"
|
||||||
|
sudo apt-get update -y
|
||||||
|
fi
|
||||||
|
sudo apt-get install -y \
|
||||||
|
postgresql-server-dev-${VERSION} postgresql-${VERSION}
|
||||||
|
else
|
||||||
|
# A dinosaur
|
||||||
|
wget -O - \
|
||||||
|
http://initd.org/psycopg/upload/postgresql/postgresql-${PACKAGE}-$(lsb_release -cs).tar.bz2 \
|
||||||
|
| sudo tar xjf - -C /usr/lib/postgresql
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo -u postgres "$PGBIN/initdb" -D "$DATADIR"
|
sudo -u postgres "$PGBIN/initdb" -D "$DATADIR"
|
||||||
|
@ -104,7 +116,9 @@ create () {
|
||||||
cd /
|
cd /
|
||||||
|
|
||||||
# Postgres versions supported by Travis CI
|
# Postgres versions supported by Travis CI
|
||||||
if [[ -z "$DONT_TEST_PRESENT" ]]; then
|
if (( ! "$DONT_TEST_PRESENT" )); then
|
||||||
|
create 12
|
||||||
|
create 11
|
||||||
create 10
|
create 10
|
||||||
create 9.6
|
create 9.6
|
||||||
create 9.5
|
create 9.5
|
||||||
|
@ -113,7 +127,7 @@ fi
|
||||||
|
|
||||||
# Unsupported postgres versions that we still support
|
# Unsupported postgres versions that we still support
|
||||||
# Images built by https://github.com/psycopg/psycopg2-wheels/tree/build-dinosaurs
|
# Images built by https://github.com/psycopg/psycopg2-wheels/tree/build-dinosaurs
|
||||||
if [[ -n "$TEST_PAST" ]]; then
|
if (( "$TEST_PAST" )); then
|
||||||
create 7.4
|
create 7.4
|
||||||
create 8.0
|
create 8.0
|
||||||
create 8.1
|
create 8.1
|
||||||
|
@ -127,6 +141,6 @@ if [[ -n "$TEST_PAST" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Postgres built from master
|
# Postgres built from master
|
||||||
if [[ -n "$TEST_FUTURE" ]]; then
|
if (( "$TEST_FUTURE" )); then
|
||||||
create 11 11-master
|
create 13 13-master
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -16,7 +16,7 @@ set -e -x
|
||||||
run_test () {
|
run_test () {
|
||||||
VERSION=$1
|
VERSION=$1
|
||||||
DBNAME=psycopg2_test
|
DBNAME=psycopg2_test
|
||||||
if [[ -n "$TEST_VERBOSE" ]]; then
|
if (( "$TEST_VERBOSE" )); then
|
||||||
VERBOSE=--verbose
|
VERBOSE=--verbose
|
||||||
else
|
else
|
||||||
VERBOSE=
|
VERBOSE=
|
||||||
|
@ -45,7 +45,9 @@ run_test () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Postgres versions supported by Travis CI
|
# Postgres versions supported by Travis CI
|
||||||
if [[ -z "$DONT_TEST_PRESENT" ]]; then
|
if (( ! "$DONT_TEST_PRESENT" )); then
|
||||||
|
run_test 12
|
||||||
|
run_test 11
|
||||||
run_test 10
|
run_test 10
|
||||||
run_test 9.6
|
run_test 9.6
|
||||||
run_test 9.5
|
run_test 9.5
|
||||||
|
@ -54,7 +56,7 @@ fi
|
||||||
|
|
||||||
# Unsupported postgres versions that we still support
|
# Unsupported postgres versions that we still support
|
||||||
# Images built by https://github.com/psycopg/psycopg2-wheels/tree/build-dinosaurs
|
# Images built by https://github.com/psycopg/psycopg2-wheels/tree/build-dinosaurs
|
||||||
if [[ -n "$TEST_PAST" ]]; then
|
if (( "$TEST_PAST" )); then
|
||||||
run_test 9.3
|
run_test 9.3
|
||||||
run_test 9.2
|
run_test 9.2
|
||||||
run_test 9.1
|
run_test 9.1
|
||||||
|
@ -68,6 +70,6 @@ if [[ -n "$TEST_PAST" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Postgres built from master
|
# Postgres built from master
|
||||||
if [[ -n "$TEST_FUTURE" ]]; then
|
if (( "$TEST_FUTURE" )); then
|
||||||
run_test 11
|
run_test 13
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -425,7 +425,7 @@ def slow(f):
|
||||||
"""
|
"""
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def slow_(self):
|
def slow_(self):
|
||||||
if os.environ.get('PSYCOPG2_TEST_FAST'):
|
if os.environ.get('PSYCOPG2_TEST_FAST', '0') != '0':
|
||||||
return self.skipTest("slow test")
|
return self.skipTest("slow test")
|
||||||
return f(self)
|
return f(self)
|
||||||
return slow_
|
return slow_
|
||||||
|
|
Loading…
Reference in New Issue
Block a user