From: Daniele Varrazzo Date: Mon, 23 May 2022 00:46:42 +0000 (+0200) Subject: fix: drop "char" - character alias X-Git-Tag: 3.1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f963aa70490a267ac0b591b17272ae8f7d3a985;p=thirdparty%2Fpsycopg.git fix: drop "char" - character alias "char", with quotes, is not an alias for character, bpchar is. Don't rely on regtype to get its alias. --- diff --git a/psycopg/psycopg/postgres.py b/psycopg/psycopg/postgres.py index 713bba701..0a6bdc4d8 100644 --- a/psycopg/psycopg/postgres.py +++ b/psycopg/psycopg/postgres.py @@ -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), diff --git a/tools/update_oids.py b/tools/update_oids.py index 98d8fce6c..802af1f81 100755 --- a/tools/update_oids.py +++ b/tools/update_oids.py @@ -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