]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix(crdb): drop spurious quotes from multi-words regtypes
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 6 Jun 2022 00:04:30 +0000 (02:04 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 12 Jul 2022 11:58:34 +0000 (12:58 +0100)
psycopg/psycopg/crdb.py
tools/update_oids.py

index cf61d7a72751b6efaee1b7b6be157324840230b6..b99ae6844a6127c85316f4e36b238895111ee1e9 100644 (file)
@@ -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)
index 17be3ac24c0c84bf9329afbad790996ea054af3b..6812446f43b588140981a237911d41c73db6ad29 100755 (executable)
@@ -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