Skip to content

Commit 6b07ba7

Browse files
revert: substring function logic back to original isStandardFunctionCallSyntax
Co-Authored-By: Dan Lynch <[email protected]>
1 parent bd4f1b6 commit 6b07ba7

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

packages/transform/src/transformers/v13-to-v14.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -909,22 +909,25 @@ export class V13ToV14Transformer {
909909
return 'COERCE_EXPLICIT_CALL';
910910
}
911911

912+
if (funcname.toLowerCase() === 'substring') {
913+
return 'COERCE_SQL_SYNTAX';
914+
}
915+
916+
const explicitCallFunctions = [
917+
'substr', 'timestamptz', 'timestamp', 'date', 'time', 'timetz',
918+
'interval', 'numeric', 'decimal', 'float4', 'float8', 'int2', 'int4', 'int8',
919+
'bool', 'text', 'varchar', 'char', 'bpchar'
920+
];
921+
912922
const sqlSyntaxFunctions = [
913923
'btrim', 'trim', 'ltrim', 'rtrim',
914924
'position', 'overlay',
915-
'extract',
925+
'extract', 'timezone',
916926
'current_date', 'current_time', 'current_timestamp',
917927
'localtime', 'localtimestamp', 'overlaps'
918928
];
919929

920-
if (funcname.toLowerCase() === 'substr') {
921-
return 'COERCE_EXPLICIT_CALL';
922-
}
923-
924-
if (funcname.toLowerCase() === 'substring') {
925-
if (this.isSqlStandardSyntax(node, context)) {
926-
return 'COERCE_SQL_SYNTAX';
927-
}
930+
if (explicitCallFunctions.includes(funcname.toLowerCase())) {
928931
return 'COERCE_EXPLICIT_CALL';
929932
}
930933

0 commit comments

Comments
 (0)