Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: display spatial types (geometry/geography) as hex (#18580)

Vincent Huang7a6f7921a392
diff --git a/backend/plugin/db/mssql/query.go b/backend/plugin/db/mssql/query.go
index 46c4754cbe..73203d04bc 100644
--- a/backend/plugin/db/mssql/query.go
+++ b/backend/plugin/db/mssql/query.go
@@ -58,6 +58,8 @@ func makeValueByTypeName(typeName string, _ *sql.ColumnType) any {
return new([]byte)
case "SQL_VARIANT":
return new([]byte)
+ case "GEOMETRY", "GEOGRAPHY":
+ return new([]byte)
default:
// For unknown types, default to sql.NullString which can handle most values
return new(sql.NullString)
diff --git a/backend/plugin/db/mysql/query.go b/backend/plugin/db/mysql/query.go
index ceba7eeca8..f835df512b 100644
--- a/backend/plugin/db/mysql/query.go
+++ b/backend/plugin/db/mysql/query.go
@@ -31,6 +31,8 @@ func makeValueByTypeName(typeName string, _ *sql.ColumnType) any {
return new(sql.NullFloat64)
case "BIT", "VARBIT", "BINARY", "VARBINARY":
return new([]byte)
+ case "GEOMETRY", "POINT", "LINESTRING", "POLYGON", "MULTIPOINT", "MULTILINESTRING", "MULTIPOLYGON", "GEOMETRYCOLLECTION":
+ return new([]byte)
default:
return new(sql.NullString)
}
diff --git a/backend/plugin/db/pg/query.go b/backend/plugin/db/pg/query.go
index 3cec09eb0d..48afb795e6 100644
--- a/backend/plugin/db/pg/query.go
+++ b/backend/plugin/db/pg/query.go
@@ -37,6 +37,8 @@ func makeValueByTypeName(typeName string, _ *sql.ColumnType) any {
return new(pgtype.Timestamptz)
case "BIT", "VARBIT", "BYTEA":
return new([]byte)
+ case "GEOMETRY", "GEOGRAPHY":
+ return new([]byte)
default:
return new(sql.NullString)
}
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/binary-format-store.ts b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/binary-format-store.ts
index 3770eced29..72f90a378f 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/binary-format-store.ts
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/binary-format-store.ts
@@ -230,7 +230,17 @@ export const getBinaryFormatByColumnType = (
columnType === "varbinary(max)" ||
// Oracle binary types
columnType === "raw" ||
- columnType === "long raw";
+ columnType === "long raw" ||
+ // Spatial types (SQL Server, PostgreSQL/PostGIS, MySQL)
+ columnType === "geometry" ||
+ columnType === "geography" ||
+ columnType === "point" ||
+ columnType === "linestring" ||
+ columnType === "polygon" ||
+ columnType === "multipoint" ||
+ columnType === "multilinestring" ||
+ columnType === "multipolygon" ||
+ columnType === "geometrycollection";
// BINARY/VARBINARY/BLOB columns default to HEX format
if (isBinaryColumn) {