in baremaps-calcite/src/main/java/org/apache/baremaps/calcite/postgres/PostgresModifiableTable.java [312:360]
private String mapPostgresTypeName(String pgTypeName) {
if (pgTypeName == null) {
return "unknown";
}
// Strip size/precision information
if (pgTypeName.contains("(")) {
pgTypeName = pgTypeName.substring(0, pgTypeName.indexOf("("));
}
// Map common types
switch (pgTypeName.toLowerCase()) {
case "int4":
return "integer";
case "int8":
return "bigint";
case "int2":
return "smallint";
case "float4":
return "real";
case "float8":
return "double precision";
case "varchar":
case "character varying":
return "varchar";
case "bpchar":
case "character":
return "char";
case "text":
return "text";
case "bool":
return "boolean";
case "timestamptz":
return "timestamp with time zone";
case "timestamp":
return "timestamp without time zone";
case "date":
return "date";
case "time":
return "time";
case "timetz":
return "time with time zone";
case "numeric":
case "decimal":
return "numeric";
default:
return pgTypeName;
}
}