Some sqs fixes.

This commit is contained in:
Sam Rose 2024-11-26 17:36:17 +00:00
parent 8e756ccf84
commit f211990117
No known key found for this signature in database
4 changed files with 14 additions and 6 deletions

View File

@ -3,6 +3,7 @@ import * as dbCore from "../db"
import {
getNativeSql,
isExternalTable,
isInternalTableID,
isInvalidISODateString,
isValidFilter,
isValidISODateString,
@ -1192,7 +1193,7 @@ class InternalBuilder {
private buildJsonField(table: Table, field: string): [string, Knex.Raw] {
const parts = field.split(".")
const baseName = parts[parts.length - 1]
let baseName = parts[parts.length - 1]
let unaliased: string
let tableField: string
@ -1205,10 +1206,16 @@ class InternalBuilder {
tableField = unaliased
}
const schema = table.schema[baseName]
if (this.query.meta?.columnPrefix) {
baseName = baseName.replace(this.query.meta.columnPrefix, "")
}
let identifier = this.rawQuotedIdentifier(tableField)
if (schema.type === FieldType.BIGINT) {
// Internal tables have special _id, _rev, createdAt, and updatedAt fields
// that do not appear in the schema, meaning schema could actually be
// undefined.
const schema: FieldSchema | undefined = table.schema[baseName]
if (schema && schema.type === FieldType.BIGINT) {
identifier = this.castIntToString(identifier)
}
return [unaliased, identifier]

View File

@ -29,7 +29,7 @@ import sdk from "../../sdk"
import { builderSocket } from "../../websockets"
import { isEqual } from "lodash"
import { processTable } from "../../sdk/app/tables/getters"
import { makeExternalQuery } from "src/integrations/base/query"
import { makeExternalQuery } from "../../integrations/base/query"
export async function fetch(ctx: UserCtx) {
ctx.body = await sdk.datasources.fetch()

View File

@ -3333,7 +3333,7 @@ if (descriptions.length) {
})
isInternal &&
it("should coerce a static handlebars formula", async () => {
it.only("should coerce a static handlebars formula", async () => {
await updateFormulaColumn(encodeJS("return 1"), {
responseType: FieldType.NUMBER,
formulaType: FormulaType.STATIC,

View File

@ -494,6 +494,7 @@ export async function search(
if (err.status === 400 && msg?.match(MISSING_COLUMN_REGEX)) {
return { rows: [] }
}
throw new Error(`Unable to search by SQL - ${msg}`, { cause: err })
// throw new Error(`Unable to search by SQL - ${msg}`, { cause: err })
throw err
}
}