mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Fix 'table not found' error when converting columns in the presence of per-row ACL rules.
Summary: Column conversions involve changes to metadata tables such as _grist_Tables_column. When fetched (from GranularAccess), ExpandedQuery used to fail with 'table not found' because there is no metadata for metadata tables. This diff limits the need for metadata in ExpandedQuery to when it's actually needed (to implmement some formulas for on-demand tables), which no longer interferes with GranularAccess. Test Plan: Added a test case that reproduces the issue before the fix. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2729
This commit is contained in:
parent
8a2a14ce74
commit
8156f957b3
@ -45,6 +45,12 @@ export function expandQuery(iquery: Query, docData: DocData, onDemandFormulas: b
|
||||
limit: iquery.limit
|
||||
};
|
||||
|
||||
// Start accumulating a set of joins and selects needed for the query.
|
||||
const joins = new Set<string>();
|
||||
const selects = new Set<string>();
|
||||
|
||||
// Iterate through all formulas, adding joins and selects as we go.
|
||||
if (onDemandFormulas) {
|
||||
// Look up the main table for the query.
|
||||
const tables = docData.getTable('_grist_Tables')!;
|
||||
const columns = docData.getTable('_grist_Tables_column')!;
|
||||
@ -59,12 +65,6 @@ export function expandQuery(iquery: Query, docData: DocData, onDemandFormulas: b
|
||||
if (refTableId) { references.set(column.colId as string, refTableId); }
|
||||
}
|
||||
|
||||
// Start accumulating a set of joins and selects needed for the query.
|
||||
const joins = new Set<string>();
|
||||
const selects = new Set<string>();
|
||||
|
||||
// Iterate through all formulas, adding joins and selects as we go.
|
||||
if (onDemandFormulas) {
|
||||
selects.add(`${quoteIdent(query.tableId)}.id`);
|
||||
for (const column of dataColumns) {
|
||||
selects.add(`${quoteIdent(query.tableId)}.${quoteIdent(column.colId as string)}`);
|
||||
|
Loading…
Reference in New Issue
Block a user