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:
commit
51013b9723
|
@ -99,8 +99,12 @@ function generateSelectStatement(
|
||||||
const fieldNames = field.split(/\./g)
|
const fieldNames = field.split(/\./g)
|
||||||
const tableName = fieldNames[0]
|
const tableName = fieldNames[0]
|
||||||
const columnName = fieldNames[1]
|
const columnName = fieldNames[1]
|
||||||
if (columnName && knex.client.config.client === SqlClients.POSTGRES) {
|
if (
|
||||||
const externalType = schema?.[columnName].externalType
|
columnName &&
|
||||||
|
schema?.[columnName] &&
|
||||||
|
knex.client.config.client === SqlClients.POSTGRES
|
||||||
|
) {
|
||||||
|
const externalType = schema[columnName].externalType
|
||||||
if (externalType?.includes("money")) {
|
if (externalType?.includes("money")) {
|
||||||
return knex.raw(
|
return knex.raw(
|
||||||
`"${tableName}"."${columnName}"::money::numeric as "${field}"`
|
`"${tableName}"."${columnName}"::money::numeric as "${field}"`
|
||||||
|
|
Loading…
Reference in New Issue