|
|
@ -210,7 +210,7 @@ const pg = { |
|
|
|
SUBSTR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => { |
|
|
|
SUBSTR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => { |
|
|
|
const str = (await fn(pt.arguments[0])).builder; |
|
|
|
const str = (await fn(pt.arguments[0])).builder; |
|
|
|
const positionFrom = (await fn(pt.arguments[1] ?? 1)).builder; |
|
|
|
const positionFrom = (await fn(pt.arguments[1] ?? 1)).builder; |
|
|
|
const numberOfCharacters = (await fn(pt.arguments[2] ?? '')).builder; |
|
|
|
const numberOfCharacters = pt.arguments[2] ? (await fn(pt.arguments[2])).builder : null; |
|
|
|
return { |
|
|
|
return { |
|
|
|
builder: knex.raw( |
|
|
|
builder: knex.raw( |
|
|
|
`SUBSTR(${str}::TEXT, ${positionFrom}${ |
|
|
|
`SUBSTR(${str}::TEXT, ${positionFrom}${ |
|
|
|