]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix: drop "char" - character alias
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 23 May 2022 00:46:42 +0000 (02:46 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 23 May 2022 00:47:35 +0000 (02:47 +0200)
"char", with quotes, is not an alias for character, bpchar is.
Don't rely on regtype to get its alias.

psycopg/psycopg/postgres.py
tools/update_oids.py

index 50ab959481a3870c2775769fc07a64f5a4fbc037..14769344c389be3253e5acf5e6fc802f86d006ab 100644 (file)
@@ -16,6 +16,7 @@ adapters = AdaptersMap(types=types)
 
 # Use tools/update_oids.py to update this data.
 for t in [
+    TypeInfo('"char"', 18, 1002),
     # autogenerated: start
     # Generated from PostgreSQL 14.0
     TypeInfo("aclitem", 1033, 1034),
@@ -24,7 +25,6 @@ for t in [
     TypeInfo("box", 603, 1020, delimiter=";"),
     TypeInfo("bpchar", 1042, 1014, alt_name="character"),
     TypeInfo("bytea", 17, 1001),
-    TypeInfo("char", 18, 1002, alt_name='"char"'),
     TypeInfo("cid", 29, 1012),
     TypeInfo("cidr", 650, 651),
     TypeInfo("circle", 718, 719),
index 743ad91adce5f59d2804614fcaf6f336d51bee03..5566273b181a99c2a1911137f727484fa8425190 100755 (executable)
@@ -24,6 +24,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
+# treat "char" (with quotes) separately.
 py_types_sql = """
 select
     'TypeInfo('
@@ -42,6 +43,7 @@ select
 from pg_type t
 where
     oid < 10000
+    and oid != '"char"'::regtype
     and (typtype = 'b' or typname = 'record')
     and (typname !~ '^(_|pg_)' or typname = 'pg_lsn')
 order by typname