]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Update errors table to PostgreSQL 14
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 29 Aug 2021 06:15:05 +0000 (08:15 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 29 Aug 2021 06:15:05 +0000 (08:15 +0200)
docs/api/errors.rst
psycopg/psycopg/errors.py
tools/update_errors.py

index b735bb5c44e39cba84a24d960ee9b78a7de4ad5d..388d3870ca47c81b3e4c21390c186d96676e0c2d 100644 (file)
@@ -129,7 +129,7 @@ in the database:
         locked = True
 
 The exception names are generated from the PostgreSQL source code and includes
-classes for every error defined by PostgreSQL in versions between 9.6 and 13.
+classes for every error defined by PostgreSQL in versions between 9.6 and 14.
 Every class in the module is named after what referred as "condition name" `in
 the documentation`__, converted to CamelCase: e.g. the error 22012,
 ``division_by_zero`` is exposed by this module as the class `!DivisionByZero`.
@@ -441,6 +441,7 @@ SQLSTATE  Exception                                          Base exception
 ``57P02`` `!CrashShutdown`                                   `!OperationalError`
 ``57P03`` `!CannotConnectNow`                                `!OperationalError`
 ``57P04`` `!DatabaseDropped`                                 `!OperationalError`
+``57P05`` `!IdleSessionTimeout`                              `!OperationalError`
 **Class 58**: Class 58 - System Error (errors external to PostgreSQL itself)
 ---------------------------------------------------------------------------------
 ``58000`` `!SystemError`                                     `!OperationalError`
index 86d163f7ea9adaf1a300fc9f6571fde749d4e879..9e25986d1d5550ed4f94c5c1d664ca87f2e87234 100644 (file)
@@ -1502,6 +1502,11 @@ class DatabaseDropped(OperationalError):
     pass
 
 
+@sqlcode("IDLE_SESSION_TIMEOUT", "57P05")
+class IdleSessionTimeout(OperationalError):
+    pass
+
+
 # Class 58 - System Error (errors external to PostgreSQL itself)
 
 
index bae1247ac29664efa93306cecec63ac6b7290e6d..a9196b5dcd247fd1ad53c04fdea079d01c479ceb 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# type: ignore
 """
 Generate per-sqlstate errors from PostgreSQL source code.
 
@@ -7,7 +8,6 @@ The script can be run at a new PostgreSQL release to refresh the module.
 
 # Copyright (C) 2020-2021 The Psycopg Team
 
-
 import os
 import re
 import sys
@@ -16,7 +16,7 @@ import subprocess as sp
 from urllib.request import urlopen
 from collections import defaultdict, namedtuple
 
-from psycopg.errors import get_base_exception  # type: ignore
+from psycopg.errors import get_base_exception
 
 logger = logging.getLogger()
 logging.basicConfig(
@@ -25,7 +25,7 @@ logging.basicConfig(
 
 
 def main():
-    classes, errors = fetch_errors(["9.6", "10", "11", "12", "13"])
+    classes, errors = fetch_errors(["9.6", "10", "11", "12", "13", "14"])
 
     fn = os.path.dirname(__file__) + "/../psycopg/psycopg/errors.py"
     update_file(fn, generate_module_data(classes, errors))