1
0
Fork 0
mirror of synced 2024-06-28 11:00:55 +12:00

Merge pull request #6563 from Budibase/bug/sev2/generate-select-statement-null-pointer-fix

Don't try to check externalType of related tables
This commit is contained in:
melohagan 2022-07-08 09:21:37 +01:00 committed by GitHub
commit 51013b9723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -99,8 +99,12 @@ function generateSelectStatement(
const fieldNames = field.split(/\./g)
const tableName = fieldNames[0]
const columnName = fieldNames[1]
if (columnName && knex.client.config.client === SqlClients.POSTGRES) {
const externalType = schema?.[columnName].externalType
if (
columnName &&
schema?.[columnName] &&
knex.client.config.client === SqlClients.POSTGRES
) {
const externalType = schema[columnName].externalType
if (externalType?.includes("money")) {
return knex.raw(
`"${tableName}"."${columnName}"::money::numeric as "${field}"`