diff --git a/NEWS b/NEWS index 4940a91d7..e62ebfe15 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -Current release +Future releases --------------- What's new in psycopg 2.9.10 (unreleased) @@ -6,7 +6,12 @@ What's new in psycopg 2.9.10 (unreleased) - Add support for Python 3.13. - Drop support for Python 3.7. +- `~psycopg2.errorcodes` map and `~psycopg2.errors` classes updated to + PostgreSQL 17. + +Current release +--------------- What's new in psycopg 2.9.9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/src/errors.rst b/doc/src/errors.rst index d6a7f4f78..6b934a166 100644 --- a/doc/src/errors.rst +++ b/doc/src/errors.rst @@ -18,6 +18,8 @@ .. versionchanged:: 2.9.4 added errors introduced in PostgreSQL 15 +.. versionchanged:: 2.9.10 added errors introduced in PostgreSQL 17 + 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 diff --git a/lib/errorcodes.py b/lib/errorcodes.py index aa646c465..0bc9625eb 100644 --- a/lib/errorcodes.py +++ b/lib/errorcodes.py @@ -256,6 +256,7 @@ def lookup(code, _cache={}): NO_ACTIVE_SQL_TRANSACTION = '25P01' IN_FAILED_SQL_TRANSACTION = '25P02' IDLE_IN_TRANSACTION_SESSION_TIMEOUT = '25P03' +TRANSACTION_TIMEOUT = '25P04' # Class 26 - Invalid SQL Statement Name INVALID_SQL_STATEMENT_NAME = '26000' diff --git a/psycopg/sqlstate_errors.h b/psycopg/sqlstate_errors.h index 38ad78d9b..f413a089a 100644 --- a/psycopg/sqlstate_errors.h +++ b/psycopg/sqlstate_errors.h @@ -144,6 +144,7 @@ {"25P01", "NoActiveSqlTransaction"}, {"25P02", "InFailedSqlTransaction"}, {"25P03", "IdleInTransactionSessionTimeout"}, +{"25P04", "TransactionTimeout"}, /* Class 26 - Invalid SQL Statement Name */ {"26000", "InvalidSqlStatementName"}, diff --git a/scripts/make_errorcodes.py b/scripts/make_errorcodes.py index 378ce849c..19eefa2c6 100755 --- a/scripts/make_errorcodes.py +++ b/scripts/make_errorcodes.py @@ -19,6 +19,7 @@ import re import sys +import time from urllib.request import urlopen from collections import defaultdict @@ -32,8 +33,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 13 14 15'.split()) + classes, errors = fetch_errors("11 12 13 14 15 16 17".split()) disambiguate(errors) @@ -90,8 +90,8 @@ def parse_errors_txt(url): errors_txt_url = \ - "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;" \ - "f=src/backend/utils/errcodes.txt;hb=%s" + "https://raw.githubusercontent.com/postgres/postgres/refs/heads/%s" \ + "/src/backend/utils/errcodes.txt" def fetch_errors(versions): diff --git a/scripts/make_errors.py b/scripts/make_errors.py index 59b1b2b7d..d231c3add 100755 --- a/scripts/make_errors.py +++ b/scripts/make_errors.py @@ -29,8 +29,7 @@ def main(): os.path.dirname(__file__), "../psycopg/sqlstate_errors.h") # 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 13 14 15'.split()) + classes, errors = fetch_errors("11 12 13 14 15 16 17".split()) f = open(filename, "w") print("/*\n * Autogenerated by 'scripts/make_errors.py'.\n */\n", file=f) @@ -74,8 +73,8 @@ def parse_errors_txt(url): errors_txt_url = \ - "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;" \ - "f=src/backend/utils/errcodes.txt;hb=%s" + "https://raw.githubusercontent.com/postgres/postgres/refs/heads/%s" \ + "/src/backend/utils/errcodes.txt" def fetch_errors(versions):