Adding limit in for wide tables to be related correctly.

This commit is contained in:
mike12345567 2024-08-23 18:54:46 +01:00
parent 5d53e64360
commit b11ee56a38
1 changed files with 8 additions and 1 deletions

View File

@ -39,6 +39,7 @@ import { dataFilters, helpers } from "@budibase/shared-core"
import { cloneDeep } from "lodash" import { cloneDeep } from "lodash"
type QueryFunction = (query: SqlQuery | SqlQuery[], operation: Operation) => any type QueryFunction = (query: SqlQuery | SqlQuery[], operation: Operation) => any
const MAX_SQS_RELATIONSHIP_FIELDS = 63
function getBaseLimit() { function getBaseLimit() {
const envLimit = environment.SQL_MAX_ROWS const envLimit = environment.SQL_MAX_ROWS
@ -800,9 +801,15 @@ class InternalBuilder {
alias: throughAlias, alias: throughAlias,
schema: endpoint.schema, schema: endpoint.schema,
}) })
const relationshipFields = fields.filter( let relationshipFields = fields.filter(
field => field.split(".")[0] === toAlias field => field.split(".")[0] === toAlias
) )
if (this.client === SqlClient.SQL_LITE) {
relationshipFields = relationshipFields.slice(
0,
MAX_SQS_RELATIONSHIP_FIELDS
)
}
const fieldList: string = relationshipFields const fieldList: string = relationshipFields
.map(field => jsonField(field)) .map(field => jsonField(field))
.join(",") .join(",")