From: Daniele Varrazzo Date: Sun, 29 Aug 2021 06:47:26 +0000 (+0200) Subject: Add pg_lsn to the builtin types registry X-Git-Tag: 3.0.beta1~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=910ae4b77aa31dbcd2901709752c575d28ae0108;p=thirdparty%2Fpsycopg.git Add pg_lsn to the builtin types registry --- diff --git a/psycopg/psycopg/postgres.py b/psycopg/psycopg/postgres.py index a8f5f6a3f..e3a83afda 100644 --- a/psycopg/psycopg/postgres.py +++ b/psycopg/psycopg/postgres.py @@ -17,7 +17,7 @@ adapters = AdaptersMap(types=types) # Use tools/update_oids.py to update this data. for t in [ # autogenerated: start - # Generated from PostgreSQL 13.0 + # Generated from PostgreSQL 13.4 TypeInfo("aclitem", 1033, 1034), TypeInfo("bit", 1560, 1561), TypeInfo("bool", 16, 1000, alt_name="boolean"), @@ -51,6 +51,7 @@ for t in [ TypeInfo("oid", 26, 1028), TypeInfo("oidvector", 30, 1013), TypeInfo("path", 602, 1019), + TypeInfo("pg_lsn", 3220, 3221), TypeInfo("point", 600, 1017), TypeInfo("polygon", 604, 1027), TypeInfo("record", 2249, 2287), diff --git a/psycopg_c/psycopg_c/_psycopg/oids.pxd b/psycopg_c/psycopg_c/_psycopg/oids.pxd index 0249bb35b..c4d933c68 100644 --- a/psycopg_c/psycopg_c/_psycopg/oids.pxd +++ b/psycopg_c/psycopg_c/_psycopg/oids.pxd @@ -11,7 +11,7 @@ cdef enum: # autogenerated: start - # Generated from PostgreSQL 13.0 + # Generated from PostgreSQL 13.4 ACLITEM_OID = 1033 BIT_OID = 1560 @@ -50,6 +50,7 @@ cdef enum: OID_OID = 26 OIDVECTOR_OID = 30 PATH_OID = 602 + PG_LSN_OID = 3220 POINT_OID = 600 POLYGON_OID = 604 RECORD_OID = 2249 diff --git a/tools/update_oids.py b/tools/update_oids.py index 2b9b3643f..d2caa93be 100755 --- a/tools/update_oids.py +++ b/tools/update_oids.py @@ -23,6 +23,7 @@ $$, """ # Note: "record" is a pseudotype but still a useful one to have. +# "pg_lsn" is a documented public type and useful in streaming replication py_types_sql = """ select 'TypeInfo(' @@ -42,7 +43,7 @@ from pg_type t where oid < 10000 and (typtype = 'b' or typname = 'record') - and typname !~ '^(_|pg_)' + and (typname !~ '^(_|pg_)' or typname = 'pg_lsn') order by typname """ @@ -56,7 +57,7 @@ from where oid < 10000 and typtype = 'r' - and typname !~ '^(_|pg_)' + and (typname !~ '^(_|pg_)' or typname = 'pg_lsn') order by typname """ @@ -66,7 +67,7 @@ from pg_type where oid < 10000 and (typtype = any('{b,r}') or typname = 'record') - and typname !~ '^(_|pg_)' + and (typname !~ '^(_|pg_)' or typname = 'pg_lsn') order by typname """ @@ -80,7 +81,7 @@ def update_python_oids() -> None: def update_cython_oids() -> None: queries = [version_sql, cython_oids_sql] - fn = ROOT / "psycopg/psycopg/_psycopg/oids.pxd" + fn = ROOT / "psycopg_c/psycopg_c/_psycopg/oids.pxd" update_file(fn, queries)