@@ -886,42 +886,25 @@ export class V15ToV16Transformer {
886886 Integer ( node : PG15 . Integer , context : TransformerContext ) : { Integer : PG16 . Integer } {
887887 const result : any = { ...node } ;
888888
889- // Handle empty Integer objects that need to be transformed back from PG15 to PG16
890- // Based on specific patterns from v14-to-v15 transformer
891889 if ( Object . keys ( result ) . length === 0 ) {
892890 const parentTypes = context . parentNodeTypes || [ ] ;
893- const contextData = context as any ;
894891
895892 // DefineStmt context: Only very specific cases from v14-to-v15
896893 if ( parentTypes . includes ( 'DefineStmt' ) ) {
897- const defElemName = contextData . defElemName ;
894+ const defElemName = ( context as any ) . defElemName ;
898895
899896 // Only transform for very specific defElemName values that are documented in v14-to-v15
900897 if ( defElemName === 'initcond' ) {
901898 result . ival = - 100 ; // v14-to-v15 line 464: ival === 0 || ival === -100
902899 } else if ( defElemName === 'sspace' ) {
903900 result . ival = 0 ; // v14-to-v15 line 468: ival === 0
904901 }
905- // DefineStmt args context: Only for CREATE AGGREGATE statements (v14-to-v15 line 473)
906- else if ( ! defElemName && parentTypes . includes ( 'DefineStmt' ) && ! parentTypes . includes ( 'DefElem' ) ) {
902+ // DefineStmt args context: ival -1 or 0 should become empty Integer for aggregates (v14-to-v15 line 473)
903+ // In reverse direction (v15-to-v16), empty Integer objects in DefineStmt args should transform to ival: -1
904+ else if ( ! defElemName ) {
907905 result . ival = - 1 ; // v14-to-v15 line 473: !defElemName && (ival === -1 || ival === 0), default to -1
908906 }
909907 }
910-
911- // AlterTableCmd context: Only for SET STATISTICS operations (specific case from v14-to-v15 line 456)
912- else if ( parentTypes . includes ( 'AlterTableCmd' ) && ! parentTypes . includes ( 'DefineStmt' ) ) {
913- // Only transform for SET STATISTICS operations, not for CHECK constraints or other operations
914- const contextData = context as any ;
915- if ( contextData . alterTableSubtype === 'AT_SetStatistics' ) {
916- result . ival = - 1 ; // v14-to-v15 line 456: ival === 0 || ival === -1, default to -1
917- }
918- }
919-
920- // CreateSeqStmt context: DO NOT TRANSFORM most cases
921- // Most CreateSeqStmt DefElem args should remain as empty objects
922- // The v14-to-v15 transformer converts specific values TO empty objects
923-
924-
925908 }
926909
927910 return { Integer : result } ;
0 commit comments