Generate proper select

This commit is contained in:
Adria Navarro 2024-12-11 10:22:16 +01:00
parent 544302a129
commit 0e0b6471d6
2 changed files with 2 additions and 4 deletions

View File

@ -292,7 +292,7 @@ class InternalBuilder {
const alias = this.getTableName(table)
const schema = this.table.schema
if (!this.isFullSelectStatementRequired()) {
if (this.isFullSelectStatementRequired()) {
return [this.knex.raw("??", [`${alias}.*`])]
}
// get just the fields for this table
@ -1543,9 +1543,6 @@ class InternalBuilder {
// start building the query
let query = this.qualifiedKnex()
if (resource?.fields) {
query = query.columns(resource?.fields)
}
// handle pagination
let foundOffset: number | null = null

View File

@ -142,6 +142,7 @@ export async function buildSqlFieldList(
let table: Table
if (sdk.views.isView(source)) {
table = await sdk.views.getTable(source.id)
fields = fields.filter(f => table.schema[f].type !== FieldType.LINK)
} else {
table = source
}