Merge branch 'pg15'

This commit is contained in:
Daniele Varrazzo 2022-10-06 02:59:28 +01:00
commit 76b703e910
10 changed files with 38 additions and 11 deletions

View File

@ -18,14 +18,14 @@ jobs:
- {python: "3.8", postgres: "12"} - {python: "3.8", postgres: "12"}
- {python: "3.9", postgres: "13"} - {python: "3.9", postgres: "13"}
- {python: "3.10", postgres: "14"} - {python: "3.10", postgres: "14"}
- {python: "3.11-dev", postgres: "14"} - {python: "3.11-dev", postgres: "15rc1"}
# Opposite extremes of the supported Py/PG range, other architecture # Opposite extremes of the supported Py/PG range, other architecture
- {python: "3.6", postgres: "14", architecture: "x86"} - {python: "3.6", postgres: "15rc1", architecture: "x86"}
- {python: "3.7", postgres: "13", architecture: "x86"} - {python: "3.7", postgres: "14", architecture: "x86"}
- {python: "3.8", postgres: "12", architecture: "x86"} - {python: "3.8", postgres: "13", architecture: "x86"}
- {python: "3.9", postgres: "11", architecture: "x86"} - {python: "3.9", postgres: "12", architecture: "x86"}
- {python: "3.10", postgres: "10", architecture: "x86"} - {python: "3.10", postgres: "11", architecture: "x86"}
- {python: "3.11-dev", postgres: "10", architecture: "x86"} - {python: "3.11-dev", postgres: "10", architecture: "x86"}
env: env:
@ -50,6 +50,20 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: install libpq 15
# TODO: disable after PostgreSQL 15 has been released officially.
if: true
run: |
set -x
rel=$(lsb_release -c -s)
echo "deb http://apt.postgresql.org/pub/repos/apt ${rel}-pgdg main 15" \
| sudo tee -a /etc/apt/sources.list.d/pgdg.list
sudo apt-get -qq update
pqver=$(apt-cache show libpq5 | grep ^Version: | head -1 \
| awk '{print $2}')
sudo apt-get -qq -y install "libpq-dev=${pqver}" "libpq5=${pqver}"
- name: Install tox - name: Install tox
run: pip install tox run: pip install tox
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2

2
NEWS
View File

@ -4,6 +4,8 @@ What's new in psycopg 2.9.4 (unreleased)
- Fix `register_composite()`, `register_range()` with customized search_path - Fix `register_composite()`, `register_range()` with customized search_path
(:ticket:`#1487`). (:ticket:`#1487`).
- Handle correctly composite types with names or in schemas requiring escape. - Handle correctly composite types with names or in schemas requiring escape.
- `~psycopg2.errorcodes` map and `~psycopg2.errors` classes updated to
PostgreSQL 15.
Current release Current release

View File

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

View File

@ -14,11 +14,15 @@
.. versionchanged:: 2.8.6 added errors introduced in PostgreSQL 13 .. versionchanged:: 2.8.6 added errors introduced in PostgreSQL 13
.. versionchanged:: 2.9.2 added errors introduced in PostgreSQL 14
.. versionchanged:: 2.9.4 added errors introduced in PostgreSQL 15
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 13. by PostgreSQL in versions between 9.1 and 15.
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,

View File

@ -132,7 +132,7 @@ The current `!psycopg2` implementation supports:
NOTE: keep consistent with setup.py and the /features/ page. NOTE: keep consistent with setup.py and the /features/ page.
- Python versions from 3.6 to 3.10 - Python versions from 3.6 to 3.10
- PostgreSQL server versions from 7.4 to 14 - PostgreSQL server versions from 7.4 to 15
- PostgreSQL client library version from 9.1 - PostgreSQL client library version from 9.1

View File

@ -223,6 +223,7 @@ SQL_JSON_OBJECT_NOT_FOUND = '2203C'
TOO_MANY_JSON_ARRAY_ELEMENTS = '2203D' TOO_MANY_JSON_ARRAY_ELEMENTS = '2203D'
TOO_MANY_JSON_OBJECT_MEMBERS = '2203E' TOO_MANY_JSON_OBJECT_MEMBERS = '2203E'
SQL_JSON_SCALAR_REQUIRED = '2203F' SQL_JSON_SCALAR_REQUIRED = '2203F'
SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE = '2203G'
FLOATING_POINT_EXCEPTION = '22P01' FLOATING_POINT_EXCEPTION = '22P01'
INVALID_TEXT_REPRESENTATION = '22P02' INVALID_TEXT_REPRESENTATION = '22P02'
INVALID_BINARY_REPRESENTATION = '22P03' INVALID_BINARY_REPRESENTATION = '22P03'

View File

@ -111,6 +111,7 @@
{"2203D", "TooManyJsonArrayElements"}, {"2203D", "TooManyJsonArrayElements"},
{"2203E", "TooManyJsonObjectMembers"}, {"2203E", "TooManyJsonObjectMembers"},
{"2203F", "SqlJsonScalarRequired"}, {"2203F", "SqlJsonScalarRequired"},
{"2203G", "SqlJsonItemCannotBeCastToTargetType"},
{"22P01", "FloatingPointException"}, {"22P01", "FloatingPointException"},
{"22P02", "InvalidTextRepresentation"}, {"22P02", "InvalidTextRepresentation"},
{"22P03", "InvalidBinaryRepresentation"}, {"22P03", "InvalidBinaryRepresentation"},

View File

@ -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', '12', '13', '14']) '9.1 9.2 9.3 9.4 9.5 9.6 10 11 12 13 14 15'.split())
disambiguate(errors) disambiguate(errors)

View File

@ -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', '12', '13', '14']) '9.1 9.2 9.3 9.4 9.5 9.6 10 11 12 13 14 15'.split())
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)

View File

@ -1928,11 +1928,16 @@ class TestConnectionInfo(ConnectingTestCase):
self.assertIsInstance(self.conn.info.ssl_attribute(attrib), str) self.assertIsInstance(self.conn.info.ssl_attribute(attrib), str)
else: else:
for attrib in attribs: for attrib in attribs:
# Behaviour changed in PostgreSQL 15
if attrib == "library":
continue
self.assertIsNone(self.conn.info.ssl_attribute(attrib)) self.assertIsNone(self.conn.info.ssl_attribute(attrib))
self.assertIsNone(self.conn.info.ssl_attribute('wat')) self.assertIsNone(self.conn.info.ssl_attribute('wat'))
for attrib in attribs: for attrib in attribs:
if attrib == "library":
continue
self.assertIsNone(self.bconn.info.ssl_attribute(attrib)) self.assertIsNone(self.bconn.info.ssl_attribute(attrib))