]> 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>
Thu, 16 Jun 2022 23:05:44 +0000 (01:05 +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 713bba7018b8bbe7259dcc5ce4d83d74ddebbe5e..0a6bdc4d8c4a87a0cf2f56e6fb4f111f929ca974 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, regtype="character"),
     TypeInfo("bytea", 17, 1001),
-    TypeInfo("char", 18, 1002, regtype='"char"'),
     TypeInfo("cid", 29, 1012),
     TypeInfo("cidr", 650, 651),
     TypeInfo("circle", 718, 719),
index 98d8fce6c7225e100a05bc278aefaa978f209e83..802af1f817c96fee3b044d0bf5689088bf481085 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