Skip to content

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

fix: Column display format override not working for binary data (#18132)

Vincent Huangbf7f0a5461dc
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
index e9e56a23f3..d373ccc35d 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
@@ -53,7 +53,7 @@ import { useResizeObserver } from "@vueuse/core";
import { escape } from "lodash-es";
import { NButton } from "naive-ui";
import { twMerge } from "tailwind-merge";
-import { computed, ref, watchEffect } from "vue";
+import { computed, ref } from "vue";
import { useConnectionOfCurrentSQLEditorTab } from "@/store";
import { Engine } from "@/types/proto-es/v1/common_pb";
import type { QueryRow, RowValue } from "@/types/proto-es/v1/sql_service_pb";
@@ -109,30 +109,6 @@ const binaryFormat = computed(() => {
});
});
-watchEffect(() => {
- if (!hasByteData.value) {
- return;
- }
- if (!binaryFormat.value) {
- const bytesValue =
- props.value.kind?.case === "bytesValue"
- ? props.value.kind.value
- : undefined;
- if (bytesValue) {
- const binaryFormat = detectBinaryFormat({
- bytesValue,
- columnType: props.columnType,
- });
- setBinaryFormat({
- rowIndex: props.rowIndex,
- colIndex: props.colIndex,
- setIndex: props.setIndex,
- format: binaryFormat,
- });
- }
- }
-});
-
useResizeObserver(wrapperRef, (entries) => {
const div = entries[0].target as HTMLDivElement;
const contentHeight = div.scrollHeight;
@@ -203,7 +179,7 @@ const formattedValue = computed(() => {
// Determine the format to use - column override, cell override, or auto-detected format
let actualFormat = binaryFormat.value ?? "DEFAULT";
- // If format is DEFAULT, use the auto-detected format
+ // If format is DEFAULT or undefined, auto-detect based on column type and content
if (actualFormat === "DEFAULT") {
actualFormat = detectBinaryFormat({
bytesValue,
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/binary-format-store.ts b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/binary-format-store.ts
index b47127e920..812f835170 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/binary-format-store.ts
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/binary-format-store.ts
@@ -87,7 +87,13 @@ export const provideBinaryFormatContext = (contextId: Ref<string>) => {
setIndex,
contextId: contextId.value,
});
- formattedBinaryValues.value.set(key, format);
+
+ // If setting to DEFAULT, delete the key so it falls through to column/auto-detect
+ if (format === "DEFAULT") {
+ formattedBinaryValues.value.delete(key);
+ } else {
+ formattedBinaryValues.value.set(key, format);
+ }
};
const context: BinaryFormatContext = {