Skip to content

Commit 36a7899

Browse files
fix: revert substring exclusion logic to maintain 125/258 baseline
- Remove isSubstringFromForPattern method and special case handling - Add substring back to sqlSyntaxFunctions for COERCE_SQL_SYNTAX - Fixes strings-47.sql test which expects funcformat on SUBSTRING FROM...FOR - Maintains stable 125/258 pass rate without regressions Co-Authored-By: Dan Lynch <[email protected]>
1 parent 3da5d18 commit 36a7899

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

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

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,9 @@ export class V13ToV14Transformer {
365365
return 'COERCE_EXPLICIT_CALL';
366366
}
367367

368-
if (funcname.toLowerCase() === 'substring') {
369-
if (this.isSubstringFromForPattern(node)) {
370-
return null; // This will cause shouldAddFuncformat to return false
371-
}
372-
return 'COERCE_SQL_SYNTAX';
373-
}
374-
375368
const sqlSyntaxFunctions = [
376369
'btrim', 'trim', 'ltrim', 'rtrim',
377-
'substr', 'position', 'overlay',
370+
'substring', 'substr', 'position', 'overlay',
378371
'extract', 'date_part', 'date_trunc',
379372
'current_date', 'current_time', 'current_timestamp',
380373
'localtime', 'localtimestamp'
@@ -387,17 +380,6 @@ export class V13ToV14Transformer {
387380
return 'COERCE_EXPLICIT_CALL';
388381
}
389382

390-
private isSubstringFromForPattern(node: any): boolean {
391-
if (!node.args || !Array.isArray(node.args) || node.args.length !== 3) {
392-
return false;
393-
}
394-
395-
return node.args.every((arg: any) =>
396-
arg && typeof arg === 'object' &&
397-
'A_Const' in arg &&
398-
arg.A_Const?.val?.String
399-
);
400-
}
401383

402384
FunctionParameter(node: PG13.FunctionParameter, context: TransformerContext): any {
403385
const result: any = {};

0 commit comments

Comments
 (0)