]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Add pg_lsn to the builtin types registry
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 29 Aug 2021 06:47:26 +0000 (08:47 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 29 Aug 2021 06:47:26 +0000 (08:47 +0200)
psycopg/psycopg/postgres.py
psycopg_c/psycopg_c/_psycopg/oids.pxd
tools/update_oids.py

index a8f5f6a3f50cf06575b5e7255fd5f7af6588c472..e3a83afda40523070504c249e00de548884f6f80 100644 (file)
@@ -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),
index 0249bb35bb1ba18f029f047a416609f8d7a4294e..c4d933c680024ee506a070b8e642349944d8eb18 100644 (file)
@@ -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
index 2b9b3643fbd957b85c7a08629c4c72eb02710a3c..d2caa93be608d44ae344cc3a46e5391dab5253d9 100755 (executable)
@@ -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)