fix(postgres): improve view column save guidance

This commit is contained in:
zipg authored and GitHub committed 2026-07-24 15:51:27 +08:00
1 parent 0992c52448
commit 6ddfa8bd24
11 files changed
+74 -9

No files matched your search

@@ -62,7 +62,7 @@ import { getTableMetadataCapabilities, type TableMetadataCapabilities } from "@/
import { buildTableSelectSql } from "@/lib/table/tableSelectSql";
import { buildDropObjectSql, buildDropTableSql, buildDuplicateTableStructureSql, buildCopyTableDataSql, buildEmptyTableSql, buildTruncateTableSql, supportsDropTableCascade, supportsTruncateTableCascade, type TableAdminSqlOptions } from "@/lib/database/dbAdminSql";
import { useToast } from "@/composables/useToast";
import { buildExecutableObjectSourceStatements, buildRoutineRenameObjectSourceStatements, executeObjectSourceSave, supportsSourceBackedRoutineRename } from "@/lib/table/objectSourceEditor";
import { buildExecutableObjectSourceStatements, buildRoutineRenameObjectSourceStatements, executeObjectSourceSave, formatObjectSourceSaveError, supportsSourceBackedRoutineRename } from "@/lib/table/objectSourceEditor";
import { buildRenameObjectSql, supportsObjectRename } from "@/lib/table/objectRenameSql";
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
import { generateDatabaseExportId } from "@/lib/export/databaseExport";
@@ -2037,9 +2037,9 @@ async function saveSource() {
sourceEditing.value = false;
sourceDraft.value = "";
await openSource(row);
} catch (e: any) {
} catch (e: unknown) {
if (sidePanelGuard.isStale(epoch)) return;
sourceSaveError.value = e?.message || String(e);
sourceSaveError.value = formatObjectSourceSaveError(e, effectiveDatabaseType.value, row.type as ObjectSourceKind, t("objects.postgresViewColumnChangeHint"));
} finally {
if (sidePanelGuard.isFresh(epoch)) sourceSaving.value = false;
}
@@ -2890,7 +2890,7 @@ function getObjectBrowserMenuItems(item: ObjectBrowserRow): ContextMenuItem[] {
force-word-wrap
@save="saveSource"
/>
<div v-if="sourceSaveError" class="shrink-0 border-t px-3 py-2 text-xs text-destructive">
<div v-if="sourceSaveError" class="shrink-0 whitespace-pre-wrap break-words border-t px-3 py-2 text-xs text-destructive">
{{ sourceSaveError }}
</div>
</div>
@@ -7,7 +7,7 @@ import { useConnectionStore } from "@/stores/connectionStore";
import { useSettingsStore } from "@/stores/settingsStore";
import { copyToClipboard } from "@/lib/common/clipboard";
import { formatSqlForDisplay, type SqlFormatDialect } from "@/lib/sql/sqlFormatter";
import { buildEditableObjectSource, buildExecutableObjectSourceStatements, executeObjectSourceSave } from "@/lib/table/objectSourceEditor";
import { buildEditableObjectSource, buildExecutableObjectSourceStatements, executeObjectSourceSave, formatObjectSourceSaveError } from "@/lib/table/objectSourceEditor";
import { executeWithProductionSqlGuard } from "@/lib/database/productionExecutionGuard";
import * as api from "@/lib/backend/api";
import QueryEditor from "@/components/editor/QueryEditor.vue";
@@ -169,8 +169,8 @@ async function saveSource() {
toast(t("objects.sourceSaved"));
emit("saved");
await loadSource(false);
} catch (e: any) {
saveError.value = e?.message || String(e);
} catch (e: unknown) {
saveError.value = formatObjectSourceSaveError(e, databaseType, props.objectType, t("objects.postgresViewColumnChangeHint"));
} finally {
saving.value = false;
}
@@ -213,7 +213,7 @@ function closeDialog() {
hide-execution-controls
@save="saveSource"
/>
<div v-if="saveError" class="shrink-0 border-t px-3 py-2 text-xs text-destructive">
<div v-if="saveError" class="shrink-0 whitespace-pre-wrap break-words border-t px-3 py-2 text-xs text-destructive">
{{ saveError }}
</div>
</div>