From: Daniele Varrazzo Date: Mon, 6 Jun 2022 00:04:30 +0000 (+0200) Subject: fix(crdb): drop spurious quotes from multi-words regtypes X-Git-Tag: 3.1~49^2~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afa40d5ae291837ede95b91f10468986639624ba;p=thirdparty%2Fpsycopg.git fix(crdb): drop spurious quotes from multi-words regtypes --- diff --git a/psycopg/psycopg/crdb.py b/psycopg/psycopg/crdb.py index cf61d7a72..b99ae6844 100644 --- a/psycopg/psycopg/crdb.py +++ b/psycopg/psycopg/crdb.py @@ -278,7 +278,7 @@ for t in [ TypeInfo("bytea", 17, 1001), TypeInfo("date", 1082, 1182), TypeInfo("float4", 700, 1021, regtype="real"), - TypeInfo("float8", 701, 1022, regtype="'double precision'"), + TypeInfo("float8", 701, 1022, regtype="double precision"), TypeInfo("inet", 869, 1041), TypeInfo("int2", 21, 1005, regtype="smallint"), TypeInfo("int2vector", 22, 1006), @@ -298,14 +298,14 @@ for t in [ TypeInfo("regrole", 4096, 4097), TypeInfo("regtype", 2206, 2211), TypeInfo("text", 25, 1009), - TypeInfo("time", 1083, 1183, regtype="'time without time zone'"), - TypeInfo("timestamp", 1114, 1115, regtype="'timestamp without time zone'"), - TypeInfo("timestamptz", 1184, 1185, regtype="'timestamp with time zone'"), - TypeInfo("timetz", 1266, 1270, regtype="'time with time zone'"), + TypeInfo("time", 1083, 1183, regtype="time without time zone"), + TypeInfo("timestamp", 1114, 1115, regtype="timestamp without time zone"), + TypeInfo("timestamptz", 1184, 1185, regtype="timestamp with time zone"), + TypeInfo("timetz", 1266, 1270, regtype="time with time zone"), TypeInfo("unknown", 705, 0), TypeInfo("uuid", 2950, 2951), - TypeInfo("varbit", 1562, 1563, regtype="'bit varying'"), - TypeInfo("varchar", 1043, 1015, regtype="'character varying'"), + TypeInfo("varbit", 1562, 1563, regtype="bit varying"), + TypeInfo("varchar", 1043, 1015, regtype="character varying"), # autogenerated: end ]: types.add(t) diff --git a/tools/update_oids.py b/tools/update_oids.py index 17be3ac24..6812446f4 100755 --- a/tools/update_oids.py +++ b/tools/update_oids.py @@ -88,7 +88,10 @@ def get_py_types(conn: Connection) -> List[str]: lines = [] for (typname, oid, typarray, regtype, typdelim) in conn.execute( """ -select typname, oid, typarray, typname::regtype::text as regtype, typdelim +select typname, oid, typarray, + -- CRDB might have quotes in the regtype representation + replace(typname::regtype::text, '''', '') as regtype, + typdelim from pg_type t where oid < 10000