From: Daniele Varrazzo Date: Sun, 29 Mar 2020 01:47:11 +0000 (+1300) Subject: Oid map updated to PG 12 X-Git-Tag: 3.0.dev0~652 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f08a6e1a8a48182afcff9e57444ea63edd09d428;p=thirdparty%2Fpsycopg.git Oid map updated to PG 12 --- diff --git a/psycopg3/types/oids.py b/psycopg3/types/oids.py index 3183be8b7..025f6a337 100644 --- a/psycopg3/types/oids.py +++ b/psycopg3/types/oids.py @@ -7,14 +7,15 @@ to a Postgres server. # Copyright (C) 2020 The Psycopg Team +import re + INVALID_OID = 0 # typname, oid, array oid, regtype _oids_table = [ # autogenerated start - # Generated from PostgreSQL 11 - ("abstime", 702, 1023, "abstime"), + # Generated from PostgreSQL 12.2 ("aclitem", 1033, 1034, "aclitem"), ("any", 2276, 0, '"any"'), ("anyarray", 2277, 0, "anyarray"), @@ -49,6 +50,7 @@ _oids_table = [ ("interval", 1186, 1187, "interval"), ("json", 114, 199, "json"), ("jsonb", 3802, 3807, "jsonb"), + ("jsonpath", 4072, 4073, "jsonpath"), ("line", 628, 629, "line"), ("lseg", 601, 1018, "lseg"), ("macaddr", 829, 1040, "macaddr"), @@ -65,15 +67,12 @@ _oids_table = [ ("polygon", 604, 1027, "polygon"), ("record", 2249, 2287, "record"), ("refcursor", 1790, 2201, "refcursor"), - ("reltime", 703, 1024, "reltime"), - ("smgr", 210, 0, "smgr"), ("text", 25, 1009, "text"), ("tid", 27, 1010, "tid"), ("time", 1083, 1183, "time without time zone"), ("timestamp", 1114, 1115, "timestamp without time zone"), ("timestamptz", 1184, 1185, "timestamp with time zone"), ("timetz", 1266, 1270, "time with time zone"), - ("tinterval", 704, 1025, "tinterval"), ("trigger", 2279, 0, "trigger"), ("tsquery", 3615, 3645, "tsquery"), ("tsrange", 3908, 3909, "tsrange"), @@ -99,7 +98,9 @@ def self_update(): # queries output should make black happy queries = [ """ -select format(' # Generated from PostgreSQL %s', setting::int / 10000) +select format( + ' # Generated from PostgreSQL %s.%s', + setting::int / 10000, setting::int % 100) -- assume PG >= 10 from pg_settings where name = 'server_version_num' """, @@ -128,11 +129,10 @@ select format( ) new.extend(out.stdout.splitlines()) - (istart,) = [ - i for i, l in enumerate(lines) if b"autogenerated " + b"start" in l - ] - (iend,) = [ - i for i, l in enumerate(lines) if b"autogenerated " + b"end" in l + istart, iend = [ + i + for i, l in enumerate(lines) + if re.match(br"\s*#\s*autogenerated\s+(start|end)", l) ] lines[istart + 1 : iend] = new