fix(grid): allow deleting rows from DISTINCT join results
This commit is contained in:
2 files changed
+6
-2
No files matched your search
@@ -4432,7 +4432,11 @@ export const useQueryStore = defineStore("query", () => {
|
|||||||
const queryAnalysis = {
|
const queryAnalysis = {
|
||||||
...target.analysis,
|
...target.analysis,
|
||||||
...(target.analysis.distinct && canInsertIntoEditableQuerySource(tab, dbType as DatabaseType, target, target.sourceColumns) ? { allowInsert: true } : {}),
|
...(target.analysis.distinct && canInsertIntoEditableQuerySource(tab, dbType as DatabaseType, target, target.sourceColumns) ? { allowInsert: true } : {}),
|
||||||
allowDelete: !target.analysis.distinct,
|
// A DISTINCT result is still one-to-one with the selected source row
|
||||||
|
// when that source's complete primary key is present in the projection.
|
||||||
|
// The candidate filter above guarantees that identity before enabling
|
||||||
|
// the primary-key based delete SQL.
|
||||||
|
allowDelete: true,
|
||||||
allowInsertDelete: false,
|
allowInsertDelete: false,
|
||||||
multiSource: true,
|
multiSource: true,
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -3438,7 +3438,7 @@ test("binds DISTINCT qualified-star edits to the single safe joined source", asy
|
|||||||
assert.equal(tab?.queryAnalysis?.multiSource, true);
|
assert.equal(tab?.queryAnalysis?.multiSource, true);
|
||||||
assert.equal(tab?.queryAnalysis?.distinct, true);
|
assert.equal(tab?.queryAnalysis?.distinct, true);
|
||||||
assert.equal(tab?.queryAnalysis?.allowInsert, true);
|
assert.equal(tab?.queryAnalysis?.allowInsert, true);
|
||||||
assert.equal(tab?.queryAnalysis?.allowDelete, false);
|
assert.equal(tab?.queryAnalysis?.allowDelete, true);
|
||||||
assert.equal(tab?.queryAnalysis?.allowInsertDelete, false);
|
assert.equal(tab?.queryAnalysis?.allowInsertDelete, false);
|
||||||
assert.equal(tab?.tableMeta?.tableName, "users");
|
assert.equal(tab?.tableMeta?.tableName, "users");
|
||||||
assert.deepEqual(tab?.querySourceColumns, ["id", "name"]);
|
assert.deepEqual(tab?.querySourceColumns, ["id", "name"]);
|
||||||
|
|||||||
Reference in new issue
Block a user