Skip to content

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

chore: filter SET commands from creating a new tab (#15162)

Vincent Huang235f7af4b22a
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
index 9fbc03320f..1fcb6584bb 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
@@ -22,7 +22,7 @@
style="--n-tab-padding: 4px 12px"
>
<NTabPane
- v-for="(result, i) in resultSet.results"
+ v-for="(result, i) in filteredResults"
:key="i"
:name="tabName(result, i)"
class="flex-1 flex flex-col overflow-hidden"
@@ -257,6 +257,17 @@ const disallowCopyingData = computed(() => {
return false;
});
+const filteredResults = computed(() => {
+ if (!props.resultSet) {
+ return []; // If resultSet is undefined, return an empty array
+ }
+
+ // Skip SET commands when displaying results
+ return props.resultSet.results.filter(result => {
+ return !result.statement.trim().toUpperCase().startsWith("SET");
+ });
+});
+
provideSQLResultViewContext({
dark: toRef(props, "dark"),
disallowCopyingData,