builtins = TypesRegistry()
+# In order to update the registry, just execute this file, using the PG*
+# env vars to point to a running PostgreSQL instance of the desired version.
for r in [
# fmt: off
# autogenerated: start
- # Generated from PostgreSQL 12.2
+ # Generated from PostgreSQL 13.0
('aclitem', 1033, 1034, 'aclitem', ','),
('any', 2276, 0, '"any"', ','),
('anyarray', 2277, 0, 'anyarray', ','),
+ ('anycompatible', 5077, 0, 'anycompatible', ','),
+ ('anycompatiblearray', 5078, 0, 'anycompatiblearray', ','),
+ ('anycompatiblenonarray', 5079, 0, 'anycompatiblenonarray', ','),
+ ('anycompatiblerange', 5080, 0, 'anycompatiblerange', ','),
('anyelement', 2283, 0, 'anyelement', ','),
('anyenum', 3500, 0, 'anyenum', ','),
('anynonarray', 2776, 0, 'anynonarray', ','),
('numrange', 3906, 3907, 'numrange', ','),
('oid', 26, 1028, 'oid', ','),
('oidvector', 30, 1013, 'oidvector', ','),
- ('opaque', 2282, 0, 'opaque', ','),
('path', 602, 1019, 'path', ','),
('point', 600, 1017, 'point', ','),
('polygon', 604, 1027, 'polygon', ','),
('varchar', 1043, 1015, 'character varying', ','),
('void', 2278, 0, 'void', ','),
('xid', 28, 1011, 'xid', ','),
+ ('xid8', 5069, 271, 'xid8', ','),
('xml', 142, 143, 'xml', ','),
# autogenerated: end
# fmt: on
import os
import re
import sys
+import logging
+import subprocess as sp
from urllib.request import urlopen
from collections import defaultdict
from psycopg3.errors import get_base_exception
+logger = logging.getLogger()
+logging.basicConfig(
+ level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s"
+)
+
def main():
- fn = os.path.dirname(__file__) + "/../psycopg3/errors.py"
+ fn = os.path.dirname(__file__) + "/../psycopg3/psycopg3/errors.py"
with open(fn, "r") as f:
lines = f.read().splitlines()
if re.match(r"\s*#\s*autogenerated:\s+(start|end)", line)
]
- classes, errors = fetch_errors(["9.5", "9.6", "10", "11", "12"])
+ classes, errors = fetch_errors(["9.5", "9.6", "10", "11", "12", "13"])
lines[istart + 1 : iend] = generate_module_data(classes, errors)
with open(fn, "w") as f:
for line in lines:
f.write(line + "\n")
+ logger.info("running black on the resulting module")
+ sp.check_call(["black", fn])
+
def parse_errors_txt(url):
classes = {}
errors = defaultdict(dict)
for version in versions:
- print(version, file=sys.stderr)
+ logger.info("fetching errors from version %s", version)
tver = tuple(map(int, version.split()[0].split(".")))
tag = "%s%s_STABLE" % (
(tver[0] >= 10 and "REL_" or "REL"),