Browse Source
Merge pull request #6563 from Budibase/bug/sev2/generate-select-statement-null-pointer-fix
Don't try to check externalType of related tables
master
melohagan
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
2 deletions
-
packages/server/src/integrations/base/sql.ts
|
|
|
@ -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}"` |
|
|
|
|