@@ -420,30 +420,16 @@ export class V15ToV16Transformer {
420420 FuncCall ( node : PG15 . FuncCall , context : TransformerContext ) : { FuncCall : PG16 . FuncCall } {
421421 const result : any = { } ;
422422
423- let funcName = '' ;
424- if ( node . funcname && Array . isArray ( node . funcname ) && node . funcname . length > 0 ) {
425- const lastNamePart = node . funcname [ node . funcname . length - 1 ] ;
426- if ( lastNamePart && typeof lastNamePart === 'object' && 'String' in lastNamePart ) {
427- funcName = lastNamePart . String . sval || '' ;
428- }
429- }
430-
431423 if ( node . funcname !== undefined ) {
432424 result . funcname = Array . isArray ( node . funcname )
433425 ? node . funcname . map ( ( item : any ) => this . transform ( item as any , context ) )
434426 : this . transform ( node . funcname as any , context ) ;
435427 }
436428
437429 if ( node . args !== undefined ) {
438- const childContext : TransformerContext = {
439- ...context ,
440- parentNodeTypes : [ ...( context . parentNodeTypes || [ ] ) , 'FuncCall' ] ,
441- funcName : funcName
442- } ;
443-
444430 result . args = Array . isArray ( node . args )
445- ? node . args . map ( ( item : any ) => this . transform ( item as any , childContext ) )
446- : this . transform ( node . args as any , childContext ) ;
431+ ? node . args . map ( ( item : any ) => this . transform ( item as any , context ) )
432+ : this . transform ( node . args as any , context ) ;
447433 }
448434
449435 if ( node . agg_order !== undefined ) {
@@ -560,27 +546,15 @@ export class V15ToV16Transformer {
560546 if ( result . ival !== undefined ) {
561547 const childContext : TransformerContext = {
562548 ...context ,
563- parentNodeTypes : [ ...( context . parentNodeTypes || [ ] ) , 'A_Const' ] ,
564- originalSql : ( context as any ) . originalSql ,
565- currentLocation : node . location
549+ parentNodeTypes : [ ...( context . parentNodeTypes || [ ] ) , 'A_Const' ]
566550 } ;
567551
568552 // Handle empty Integer objects directly since transform() can't detect their type
569553 if ( typeof result . ival === 'object' && Object . keys ( result . ival ) . length === 0 ) {
570554 const parentTypes = childContext . parentNodeTypes || [ ] ;
571555
572- let shouldTransformFuncCall = false ;
573- if ( parentTypes . includes ( 'FuncCall' ) ) {
574- // Only transform for specific function names to avoid regressions
575- const funcName = ( context as any ) . funcName ;
576- if ( funcName && [ 'substr' , 'length' , 'position' , 'lpad' , 'rpad' , 'repeat' ] . includes ( funcName . toLowerCase ( ) ) ) {
577- shouldTransformFuncCall = true ;
578- }
579- }
580-
581556 if ( parentTypes . includes ( 'TypeName' ) ||
582- ( parentTypes . includes ( 'DefineStmt' ) && ! ( context as any ) . defElemName ) ||
583- shouldTransformFuncCall ) {
557+ ( parentTypes . includes ( 'DefineStmt' ) && ! ( context as any ) . defElemName ) ) {
584558 result . ival = this . Integer ( result . ival as any , childContext ) . Integer ;
585559 }
586560 } else {
@@ -929,24 +903,6 @@ export class V15ToV16Transformer {
929903 if ( parentTypes . includes ( 'TypeName' ) ) {
930904 result . ival = - 1 ; // Based on alter_table test failure pattern and rangetypes-289 arrayBounds
931905 }
932- else if ( parentTypes . includes ( 'FuncCall' ) && parentTypes . includes ( 'A_Const' ) ) {
933- let extractedValue = - 1 ; // Default fallback
934-
935- const funcName = ( context as any ) . funcName ;
936- const originalSql = ( context as any ) . originalSql ;
937- const location = ( context as any ) . currentLocation ;
938-
939- // Only transform for specific function names to avoid regressions
940- if ( funcName && [ 'substr' , 'length' , 'position' , 'lpad' , 'rpad' , 'repeat' ] . includes ( funcName . toLowerCase ( ) ) ) {
941- if ( originalSql && location !== undefined ) {
942- const negativeMatch = originalSql . substring ( location - 3 , location + 5 ) . match ( / - ( \d + ) / ) ;
943- if ( negativeMatch ) {
944- extractedValue = - parseInt ( negativeMatch [ 1 ] ) ;
945- }
946- }
947- result . ival = extractedValue ;
948- }
949- }
950906 // DefineStmt context: Only very specific cases from v14-to-v15
951907 else if ( parentTypes . includes ( 'DefineStmt' ) ) {
952908 const defElemName = ( context as any ) . defElemName ;
0 commit comments