fix(sqlserver): keep hidden-key sorting editable across pages

This commit is contained in:
guoyongchang authored and GitHub committed 2026-07-30 23:03:49 +08:00
1 parent 961d9683b9
commit e5287f50b4
3 files changed
+44 -4

No files matched your search

+4 -1
View File
@@ -3817,7 +3817,10 @@ export const useQueryStore = defineStore("query", () => {
if (tab.mode === "query") {
const prepared = await prepareEditableQueryExecution(tab, sqlToExecute, conn, effectiveDbType, executionDatabase, traceId, elapsed);
sqlToExecute = prepared.sql;
queryMetadataSql = prepared.metadataSql;
// Database sorting executes a generated wrapper around the user's query.
// Keep editability metadata anchored to the original query so the wrapper
// does not turn an otherwise editable result into a complex read-only one.
queryMetadataSql = options?.resultSortedSql && !options?.querySort ? queryBaseSql : prepared.metadataSql;
hiddenPrimaryKeys = prepared.hiddenPrimaryKeys;
if (options?.querySort) {
const sorted = await api.buildSortedQuerySql({