pgsql-deparser 13.16.0 → 13.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3355 @@
1
+ /**
2
+ * Auto-generated file with types stripped for better tree-shaking
3
+ * DO NOT EDIT - Generated by strip-transformer-types.ts
4
+ */
5
+
6
+ // @ts-nocheck
7
+ /**
8
+ * V15 to V16 AST Transformer
9
+ * Transforms PostgreSQL v15 AST nodes to v16 format
10
+ */
11
+ export class V15ToV16Transformer {
12
+ transform(node: any, context: any = { parentNodeTypes: [] }): any {
13
+ if (node == null) {
14
+ return null;
15
+ }
16
+ if (typeof node === 'number' || node instanceof Number) {
17
+ return node;
18
+ }
19
+ if (typeof node === 'string') {
20
+ return node;
21
+ }
22
+ if (Array.isArray(node)) {
23
+ return node.map(item => this.transform(item, context));
24
+ }
25
+ try {
26
+ return this.visit(node, context);
27
+ }
28
+ catch (error) {
29
+ const nodeType = Object.keys(node)[0];
30
+ throw new Error(`Error transforming ${nodeType}: ${(error as Error).message}`);
31
+ }
32
+ }
33
+ visit(node: any, context: any = { parentNodeTypes: [] }): any {
34
+ const nodeType = this.getNodeType(node);
35
+ // Handle empty objects
36
+ if (!nodeType) {
37
+ return {};
38
+ }
39
+ const nodeData = this.getNodeData(node);
40
+ const methodName = nodeType as keyof this;
41
+ if (typeof this[methodName] === 'function') {
42
+ const childContext: any = {
43
+ ...context,
44
+ parentNodeTypes: [...(context.parentNodeTypes || []), nodeType]
45
+ };
46
+ return (this[methodName] as any)(nodeData, childContext);
47
+ }
48
+ // If no specific method, return the node as-is
49
+ return node;
50
+ }
51
+ getNodeType(node: any): any {
52
+ const keys = Object.keys(node);
53
+ // Handle parse result structure with version and stmts
54
+ if (keys.length === 2 && keys.includes('version') && keys.includes('stmts')) {
55
+ return 'ParseResult';
56
+ }
57
+ return keys[0];
58
+ }
59
+ getNodeData(node: any): any {
60
+ const keys = Object.keys(node);
61
+ if (keys.length === 1 && typeof (node as any)[keys[0]] === 'object') {
62
+ return (node as any)[keys[0]];
63
+ }
64
+ return node;
65
+ }
66
+ ParseResult(node: any, context: any): any {
67
+ if (node && typeof node === 'object' && 'version' in node && 'stmts' in node) {
68
+ return {
69
+ version: 160000, // PG16 version
70
+ stmts: node.stmts.map((stmt: any) => {
71
+ if (stmt && typeof stmt === 'object' && 'stmt' in stmt) {
72
+ return {
73
+ ...stmt,
74
+ stmt: this.transform(stmt.stmt, context)
75
+ };
76
+ }
77
+ return this.transform(stmt, context);
78
+ })
79
+ };
80
+ }
81
+ return node as any;
82
+ }
83
+ RawStmt(node: any, context: any): {
84
+ RawStmt: any;
85
+ } {
86
+ const result: any = {};
87
+ if (node.stmt !== undefined) {
88
+ result.stmt = this.transform(node.stmt as any, context);
89
+ }
90
+ if (node.stmt_location !== undefined) {
91
+ result.stmt_location = node.stmt_location;
92
+ }
93
+ if (node.stmt_len !== undefined) {
94
+ result.stmt_len = node.stmt_len;
95
+ }
96
+ return { RawStmt: result };
97
+ }
98
+ SelectStmt(node: any, context: any): {
99
+ SelectStmt: any;
100
+ } {
101
+ const result: any = {};
102
+ if (node.distinctClause !== undefined) {
103
+ result.distinctClause = Array.isArray(node.distinctClause)
104
+ ? node.distinctClause.map((item: any) => this.transform(item as any, context))
105
+ : this.transform(node.distinctClause as any, context);
106
+ }
107
+ if (node.intoClause !== undefined) {
108
+ result.intoClause = this.transform(node.intoClause as any, context);
109
+ }
110
+ if (node.targetList !== undefined) {
111
+ result.targetList = Array.isArray(node.targetList)
112
+ ? node.targetList.map((item: any) => this.transform(item as any, context))
113
+ : this.transform(node.targetList as any, context);
114
+ }
115
+ if (node.fromClause !== undefined) {
116
+ result.fromClause = Array.isArray(node.fromClause)
117
+ ? node.fromClause.map((item: any) => this.transform(item as any, context))
118
+ : this.transform(node.fromClause as any, context);
119
+ }
120
+ if (node.whereClause !== undefined) {
121
+ result.whereClause = this.transform(node.whereClause as any, context);
122
+ }
123
+ if (node.groupClause !== undefined) {
124
+ result.groupClause = Array.isArray(node.groupClause)
125
+ ? node.groupClause.map((item: any) => this.transform(item as any, context))
126
+ : this.transform(node.groupClause as any, context);
127
+ }
128
+ if (node.groupDistinct !== undefined) {
129
+ result.groupDistinct = node.groupDistinct;
130
+ }
131
+ if (node.havingClause !== undefined) {
132
+ result.havingClause = this.transform(node.havingClause as any, context);
133
+ }
134
+ if (node.windowClause !== undefined) {
135
+ result.windowClause = Array.isArray(node.windowClause)
136
+ ? node.windowClause.map((item: any) => this.transform(item as any, context))
137
+ : this.transform(node.windowClause as any, context);
138
+ }
139
+ if (node.valuesLists !== undefined) {
140
+ result.valuesLists = Array.isArray(node.valuesLists)
141
+ ? node.valuesLists.map((item: any) => this.transform(item as any, context))
142
+ : this.transform(node.valuesLists as any, context);
143
+ }
144
+ if (node.sortClause !== undefined) {
145
+ result.sortClause = Array.isArray(node.sortClause)
146
+ ? node.sortClause.map((item: any) => this.transform(item as any, context))
147
+ : this.transform(node.sortClause as any, context);
148
+ }
149
+ if (node.limitOffset !== undefined) {
150
+ result.limitOffset = this.transform(node.limitOffset as any, context);
151
+ }
152
+ if (node.limitCount !== undefined) {
153
+ result.limitCount = this.transform(node.limitCount as any, context);
154
+ }
155
+ if (node.limitOption !== undefined) {
156
+ result.limitOption = node.limitOption;
157
+ }
158
+ if (node.lockingClause !== undefined) {
159
+ result.lockingClause = Array.isArray(node.lockingClause)
160
+ ? node.lockingClause.map((item: any) => this.transform(item as any, context))
161
+ : this.transform(node.lockingClause as any, context);
162
+ }
163
+ if (node.withClause !== undefined) {
164
+ result.withClause = this.transform(node.withClause as any, context);
165
+ }
166
+ if (node.op !== undefined) {
167
+ result.op = node.op;
168
+ }
169
+ if (node.all !== undefined) {
170
+ result.all = node.all;
171
+ }
172
+ if (node.larg !== undefined) {
173
+ result.larg = this.transform(node.larg as any, context);
174
+ }
175
+ if (node.rarg !== undefined) {
176
+ result.rarg = this.transform(node.rarg as any, context);
177
+ }
178
+ return { SelectStmt: result };
179
+ }
180
+ A_Expr(node: any, context: any): {
181
+ A_Expr: any;
182
+ } {
183
+ const result: any = {};
184
+ if (node.kind !== undefined) {
185
+ result.kind = node.kind;
186
+ }
187
+ if (node.name !== undefined) {
188
+ result.name = Array.isArray(node.name)
189
+ ? node.name.map((item: any) => this.transform(item as any, context))
190
+ : this.transform(node.name as any, context);
191
+ }
192
+ if (node.lexpr !== undefined) {
193
+ result.lexpr = this.transform(node.lexpr as any, context);
194
+ }
195
+ if (node.rexpr !== undefined) {
196
+ result.rexpr = this.transform(node.rexpr as any, context);
197
+ }
198
+ if (node.location !== undefined) {
199
+ result.location = node.location;
200
+ }
201
+ return { A_Expr: result };
202
+ }
203
+ InsertStmt(node: any, context: any): {
204
+ InsertStmt: any;
205
+ } {
206
+ const result: any = {};
207
+ if (node.relation !== undefined) {
208
+ result.relation = this.transform(node.relation as any, context);
209
+ }
210
+ if (node.cols !== undefined) {
211
+ result.cols = Array.isArray(node.cols)
212
+ ? node.cols.map((item: any) => this.transform(item as any, context))
213
+ : this.transform(node.cols as any, context);
214
+ }
215
+ if (node.selectStmt !== undefined) {
216
+ result.selectStmt = this.transform(node.selectStmt as any, context);
217
+ }
218
+ if (node.onConflictClause !== undefined) {
219
+ result.onConflictClause = this.transform(node.onConflictClause as any, context);
220
+ }
221
+ if (node.returningList !== undefined) {
222
+ result.returningList = Array.isArray(node.returningList)
223
+ ? node.returningList.map((item: any) => this.transform(item as any, context))
224
+ : this.transform(node.returningList as any, context);
225
+ }
226
+ if (node.withClause !== undefined) {
227
+ result.withClause = this.transform(node.withClause as any, context);
228
+ }
229
+ if (node.override !== undefined) {
230
+ result.override = node.override;
231
+ }
232
+ return { InsertStmt: result };
233
+ }
234
+ UpdateStmt(node: any, context: any): {
235
+ UpdateStmt: any;
236
+ } {
237
+ const result: any = {};
238
+ if (node.relation !== undefined) {
239
+ result.relation = this.transform(node.relation as any, context);
240
+ }
241
+ if (node.targetList !== undefined) {
242
+ result.targetList = Array.isArray(node.targetList)
243
+ ? node.targetList.map((item: any) => this.transform(item as any, context))
244
+ : this.transform(node.targetList as any, context);
245
+ }
246
+ if (node.whereClause !== undefined) {
247
+ result.whereClause = this.transform(node.whereClause as any, context);
248
+ }
249
+ if (node.fromClause !== undefined) {
250
+ result.fromClause = Array.isArray(node.fromClause)
251
+ ? node.fromClause.map((item: any) => this.transform(item as any, context))
252
+ : this.transform(node.fromClause as any, context);
253
+ }
254
+ if (node.returningList !== undefined) {
255
+ result.returningList = Array.isArray(node.returningList)
256
+ ? node.returningList.map((item: any) => this.transform(item as any, context))
257
+ : this.transform(node.returningList as any, context);
258
+ }
259
+ if (node.withClause !== undefined) {
260
+ result.withClause = this.transform(node.withClause as any, context);
261
+ }
262
+ return { UpdateStmt: result };
263
+ }
264
+ DeleteStmt(node: any, context: any): {
265
+ DeleteStmt: any;
266
+ } {
267
+ const result: any = {};
268
+ if (node.relation !== undefined) {
269
+ result.relation = this.transform(node.relation as any, context);
270
+ }
271
+ if (node.usingClause !== undefined) {
272
+ result.usingClause = Array.isArray(node.usingClause)
273
+ ? node.usingClause.map((item: any) => this.transform(item as any, context))
274
+ : this.transform(node.usingClause as any, context);
275
+ }
276
+ if (node.whereClause !== undefined) {
277
+ result.whereClause = this.transform(node.whereClause as any, context);
278
+ }
279
+ if (node.returningList !== undefined) {
280
+ result.returningList = Array.isArray(node.returningList)
281
+ ? node.returningList.map((item: any) => this.transform(item as any, context))
282
+ : this.transform(node.returningList as any, context);
283
+ }
284
+ if (node.withClause !== undefined) {
285
+ result.withClause = this.transform(node.withClause as any, context);
286
+ }
287
+ return { DeleteStmt: result };
288
+ }
289
+ WithClause(node: any, context: any): {
290
+ WithClause: any;
291
+ } {
292
+ const result: any = {};
293
+ if (node.ctes !== undefined) {
294
+ result.ctes = Array.isArray(node.ctes)
295
+ ? node.ctes.map((item: any) => this.transform(item as any, context))
296
+ : this.transform(node.ctes as any, context);
297
+ }
298
+ if (node.recursive !== undefined) {
299
+ result.recursive = node.recursive;
300
+ }
301
+ if (node.location !== undefined) {
302
+ result.location = node.location;
303
+ }
304
+ return { WithClause: result };
305
+ }
306
+ ResTarget(node: any, context: any): {
307
+ ResTarget: any;
308
+ } {
309
+ const result: any = {};
310
+ if (node.name !== undefined) {
311
+ result.name = node.name;
312
+ }
313
+ if (node.indirection !== undefined) {
314
+ result.indirection = Array.isArray(node.indirection)
315
+ ? node.indirection.map((item: any) => this.transform(item as any, context))
316
+ : this.transform(node.indirection as any, context);
317
+ }
318
+ if (node.val !== undefined) {
319
+ result.val = this.transform(node.val as any, context);
320
+ }
321
+ if (node.location !== undefined) {
322
+ result.location = node.location;
323
+ }
324
+ return { ResTarget: result };
325
+ }
326
+ BoolExpr(node: any, context: any): {
327
+ BoolExpr: any;
328
+ } {
329
+ const result: any = {};
330
+ if (node.boolop !== undefined) {
331
+ result.boolop = node.boolop;
332
+ }
333
+ if (node.args !== undefined) {
334
+ result.args = Array.isArray(node.args)
335
+ ? node.args.map((item: any) => this.transform(item as any, context))
336
+ : this.transform(node.args as any, context);
337
+ }
338
+ if (node.location !== undefined) {
339
+ result.location = node.location;
340
+ }
341
+ return { BoolExpr: result };
342
+ }
343
+ FuncCall(node: any, context: any): {
344
+ FuncCall: any;
345
+ } | {
346
+ ColumnRef: any;
347
+ } {
348
+ const result: any = {};
349
+ if (node.funcname !== undefined) {
350
+ if (node.funcname.length === 1 && (node.funcname[0] as any)?.String?.sval === 'json_object') {
351
+ result.funcname = [
352
+ {
353
+ String: { sval: 'pg_catalog' }
354
+ },
355
+ { String: { sval: 'json_object' } }
356
+ ];
357
+ }
358
+ else if (node.funcname.length === 2 &&
359
+ (node.funcname[0] as any)?.String?.sval === 'pg_catalog' &&
360
+ (node.funcname[1] as any)?.String?.sval === 'system_user' &&
361
+ node.funcformat === 'COERCE_SQL_SYNTAX') {
362
+ return {
363
+ ColumnRef: {
364
+ fields: [
365
+ { String: { sval: 'system_user' } }
366
+ ]
367
+ }
368
+ };
369
+ }
370
+ else {
371
+ result.funcname = Array.isArray(node.funcname)
372
+ ? node.funcname.map((item: any) => this.transform(item as any, context))
373
+ : this.transform(node.funcname as any, context);
374
+ }
375
+ }
376
+ if (node.args !== undefined) {
377
+ result.args = Array.isArray(node.args)
378
+ ? node.args.map((item: any) => this.transform(item as any, context))
379
+ : this.transform(node.args as any, context);
380
+ }
381
+ if (node.agg_order !== undefined) {
382
+ result.agg_order = Array.isArray(node.agg_order)
383
+ ? node.agg_order.map((item: any) => this.transform(item as any, context))
384
+ : this.transform(node.agg_order as any, context);
385
+ }
386
+ if (node.agg_filter !== undefined) {
387
+ result.agg_filter = this.transform(node.agg_filter as any, context);
388
+ }
389
+ if (node.over !== undefined) {
390
+ result.over = this.transform(node.over as any, context);
391
+ }
392
+ if (node.agg_within_group !== undefined) {
393
+ result.agg_within_group = node.agg_within_group;
394
+ }
395
+ if (node.agg_star !== undefined) {
396
+ result.agg_star = node.agg_star;
397
+ }
398
+ if (node.agg_distinct !== undefined) {
399
+ result.agg_distinct = node.agg_distinct;
400
+ }
401
+ if (node.func_variadic !== undefined) {
402
+ result.func_variadic = node.func_variadic;
403
+ }
404
+ if (node.funcformat !== undefined) {
405
+ result.funcformat = node.funcformat;
406
+ }
407
+ if (node.location !== undefined) {
408
+ result.location = node.location;
409
+ }
410
+ return { FuncCall: result };
411
+ }
412
+ FuncExpr(node: any, context: any): {
413
+ FuncExpr: any;
414
+ } {
415
+ const result: any = {};
416
+ if (node.xpr !== undefined) {
417
+ result.xpr = this.transform(node.xpr as any, context);
418
+ }
419
+ if (node.funcid !== undefined) {
420
+ result.funcid = node.funcid;
421
+ }
422
+ if (node.funcresulttype !== undefined) {
423
+ result.funcresulttype = node.funcresulttype;
424
+ }
425
+ if (node.funcretset !== undefined) {
426
+ result.funcretset = node.funcretset;
427
+ }
428
+ if (node.funcvariadic !== undefined) {
429
+ result.funcvariadic = node.funcvariadic;
430
+ }
431
+ if (node.funcformat !== undefined) {
432
+ result.funcformat = node.funcformat;
433
+ }
434
+ if (node.funccollid !== undefined) {
435
+ result.funccollid = node.funccollid;
436
+ }
437
+ if (node.inputcollid !== undefined) {
438
+ result.inputcollid = node.inputcollid;
439
+ }
440
+ if (node.args !== undefined) {
441
+ result.args = Array.isArray(node.args)
442
+ ? node.args.map((item: any) => this.transform(item as any, context))
443
+ : this.transform(node.args as any, context);
444
+ }
445
+ if (node.location !== undefined) {
446
+ result.location = node.location;
447
+ }
448
+ return { FuncExpr: result };
449
+ }
450
+ A_Const(node: any, context: any): {
451
+ A_Const: any;
452
+ } {
453
+ const result: any = { ...node };
454
+ if (result.val) {
455
+ const val: any = result.val;
456
+ if (val.String && val.String.str !== undefined) {
457
+ result.sval = val.String.str;
458
+ delete result.val;
459
+ }
460
+ else if (val.Integer !== undefined) {
461
+ result.ival = val.Integer;
462
+ delete result.val;
463
+ }
464
+ else if (val.Float && val.Float.str !== undefined) {
465
+ result.fval = val.Float.str;
466
+ delete result.val;
467
+ }
468
+ else if (val.BitString && val.BitString.str !== undefined) {
469
+ result.bsval = val.BitString.str;
470
+ delete result.val;
471
+ }
472
+ else if (val.Null !== undefined) {
473
+ delete result.val;
474
+ }
475
+ }
476
+ return { A_Const: result };
477
+ }
478
+ ColumnRef(node: any, context: any): {
479
+ ColumnRef: any;
480
+ } | {
481
+ FuncCall: any;
482
+ } {
483
+ if (node.fields && Array.isArray(node.fields) && node.fields.length === 1) {
484
+ const field = node.fields[0];
485
+ if ((field as any)?.String?.sval === 'system_user') {
486
+ return {
487
+ FuncCall: {
488
+ funcname: [
489
+ { String: { sval: 'pg_catalog' } },
490
+ { String: { sval: 'system_user' } }
491
+ ],
492
+ funcformat: 'COERCE_SQL_SYNTAX'
493
+ }
494
+ };
495
+ }
496
+ }
497
+ const result: any = {};
498
+ if (node.fields !== undefined) {
499
+ result.fields = Array.isArray(node.fields)
500
+ ? node.fields.map((item: any) => this.transform(item as any, context))
501
+ : this.transform(node.fields as any, context);
502
+ }
503
+ if (node.location !== undefined) {
504
+ result.location = node.location;
505
+ }
506
+ return { ColumnRef: result };
507
+ }
508
+ TypeName(node: any, context: any): {
509
+ TypeName: any;
510
+ } {
511
+ const result: any = {};
512
+ if (node.names !== undefined) {
513
+ result.names = Array.isArray(node.names)
514
+ ? node.names.map((item: any) => this.transform(item as any, context))
515
+ : this.transform(node.names as any, context);
516
+ }
517
+ if (node.typeOid !== undefined) {
518
+ result.typeOid = node.typeOid;
519
+ }
520
+ if (node.setof !== undefined) {
521
+ result.setof = node.setof;
522
+ }
523
+ if (node.pct_type !== undefined) {
524
+ result.pct_type = node.pct_type;
525
+ }
526
+ if (node.typmods !== undefined) {
527
+ result.typmods = Array.isArray(node.typmods)
528
+ ? node.typmods.map((item: any) => this.transform(item as any, context))
529
+ : this.transform(node.typmods as any, context);
530
+ }
531
+ if (node.typemod !== undefined) {
532
+ result.typemod = node.typemod;
533
+ }
534
+ if (node.arrayBounds !== undefined) {
535
+ const childContext: any = {
536
+ ...context,
537
+ parentNodeTypes: [...(context.parentNodeTypes || []), 'TypeName']
538
+ };
539
+ result.arrayBounds = Array.isArray(node.arrayBounds)
540
+ ? node.arrayBounds.map((item: any) => this.transform(item as any, childContext))
541
+ : this.transform(node.arrayBounds as any, childContext);
542
+ }
543
+ if (node.location !== undefined) {
544
+ result.location = node.location;
545
+ }
546
+ return { TypeName: result };
547
+ }
548
+ Alias(node: any, context: any): {
549
+ Alias: any;
550
+ } {
551
+ const result: any = {};
552
+ if (node.aliasname !== undefined) {
553
+ result.aliasname = node.aliasname;
554
+ }
555
+ if (node.colnames !== undefined) {
556
+ result.colnames = Array.isArray(node.colnames)
557
+ ? node.colnames.map((item: any) => this.transform(item as any, context))
558
+ : this.transform(node.colnames as any, context);
559
+ }
560
+ return { Alias: result };
561
+ }
562
+ RangeVar(node: any, context: any): {
563
+ RangeVar: any;
564
+ } | {
565
+ RangeFunction: any;
566
+ } {
567
+ if (node.relname === 'system_user' && node.inh === true && node.relpersistence === 'p') {
568
+ return {
569
+ RangeFunction: {
570
+ functions: [
571
+ {
572
+ List: {
573
+ items: [
574
+ {
575
+ FuncCall: {
576
+ funcname: [
577
+ { String: { sval: 'pg_catalog' } },
578
+ { String: { sval: 'system_user' } }
579
+ ],
580
+ funcformat: 'COERCE_SQL_SYNTAX'
581
+ }
582
+ },
583
+ {} as any
584
+ ]
585
+ }
586
+ }
587
+ ]
588
+ }
589
+ };
590
+ }
591
+ const result: any = {};
592
+ if (node.catalogname !== undefined) {
593
+ result.catalogname = node.catalogname;
594
+ }
595
+ if (node.schemaname !== undefined) {
596
+ result.schemaname = node.schemaname;
597
+ }
598
+ if (node.relname !== undefined) {
599
+ result.relname = node.relname;
600
+ }
601
+ if (node.inh !== undefined) {
602
+ result.inh = node.inh;
603
+ }
604
+ if (node.relpersistence !== undefined) {
605
+ result.relpersistence = node.relpersistence;
606
+ }
607
+ if (node.alias !== undefined) {
608
+ result.alias = this.transform(node.alias as any, context);
609
+ }
610
+ if (node.location !== undefined) {
611
+ result.location = node.location;
612
+ }
613
+ return { RangeVar: result };
614
+ }
615
+ A_ArrayExpr(node: any, context: any): {
616
+ A_ArrayExpr: any;
617
+ } {
618
+ const result: any = {};
619
+ if (node.elements !== undefined) {
620
+ result.elements = Array.isArray(node.elements)
621
+ ? node.elements.map((item: any) => this.transform(item as any, context))
622
+ : this.transform(node.elements as any, context);
623
+ }
624
+ if (node.location !== undefined) {
625
+ result.location = node.location;
626
+ }
627
+ return { A_ArrayExpr: result };
628
+ }
629
+ A_Indices(node: any, context: any): {
630
+ A_Indices: any;
631
+ } {
632
+ const result: any = {};
633
+ if (node.is_slice !== undefined) {
634
+ result.is_slice = node.is_slice;
635
+ }
636
+ if (node.lidx !== undefined) {
637
+ result.lidx = this.transform(node.lidx as any, context);
638
+ }
639
+ if (node.uidx !== undefined) {
640
+ result.uidx = this.transform(node.uidx as any, context);
641
+ }
642
+ return { A_Indices: result };
643
+ }
644
+ A_Indirection(node: any, context: any): {
645
+ A_Indirection: any;
646
+ } {
647
+ const result: any = {};
648
+ if (node.arg !== undefined) {
649
+ result.arg = this.transform(node.arg as any, context);
650
+ }
651
+ if (node.indirection !== undefined) {
652
+ result.indirection = Array.isArray(node.indirection)
653
+ ? node.indirection.map((item: any) => this.transform(item as any, context))
654
+ : this.transform(node.indirection as any, context);
655
+ }
656
+ return { A_Indirection: result };
657
+ }
658
+ A_Star(node: any, context: any): {
659
+ A_Star: any;
660
+ } {
661
+ const result: any = {};
662
+ return { A_Star: result };
663
+ }
664
+ CaseExpr(node: any, context: any): {
665
+ CaseExpr: any;
666
+ } {
667
+ const result: any = {};
668
+ if (node.xpr !== undefined) {
669
+ result.xpr = this.transform(node.xpr as any, context);
670
+ }
671
+ if (node.casetype !== undefined) {
672
+ result.casetype = node.casetype;
673
+ }
674
+ if (node.casecollid !== undefined) {
675
+ result.casecollid = node.casecollid;
676
+ }
677
+ if (node.arg !== undefined) {
678
+ result.arg = this.transform(node.arg as any, context);
679
+ }
680
+ if (node.args !== undefined) {
681
+ result.args = Array.isArray(node.args)
682
+ ? node.args.map((item: any) => this.transform(item as any, context))
683
+ : this.transform(node.args as any, context);
684
+ }
685
+ if (node.defresult !== undefined) {
686
+ result.defresult = this.transform(node.defresult as any, context);
687
+ }
688
+ if (node.location !== undefined) {
689
+ result.location = node.location;
690
+ }
691
+ return { CaseExpr: result };
692
+ }
693
+ CoalesceExpr(node: any, context: any): {
694
+ CoalesceExpr: any;
695
+ } {
696
+ const result: any = {};
697
+ if (node.xpr !== undefined) {
698
+ result.xpr = this.transform(node.xpr as any, context);
699
+ }
700
+ if (node.coalescetype !== undefined) {
701
+ result.coalescetype = node.coalescetype;
702
+ }
703
+ if (node.coalescecollid !== undefined) {
704
+ result.coalescecollid = node.coalescecollid;
705
+ }
706
+ if (node.args !== undefined) {
707
+ result.args = Array.isArray(node.args)
708
+ ? node.args.map((item: any) => this.transform(item as any, context))
709
+ : this.transform(node.args as any, context);
710
+ }
711
+ if (node.location !== undefined) {
712
+ result.location = node.location;
713
+ }
714
+ return { CoalesceExpr: result };
715
+ }
716
+ TypeCast(node: any, context: any): {
717
+ TypeCast: any;
718
+ } {
719
+ const result: any = {};
720
+ if (node.arg !== undefined) {
721
+ result.arg = this.transform(node.arg as any, context);
722
+ }
723
+ if (node.typeName !== undefined) {
724
+ const childContext: any = {
725
+ ...context,
726
+ parentNodeTypes: [...(context.parentNodeTypes || []), 'TypeCast']
727
+ };
728
+ result.typeName = this.TypeName(node.typeName as any, childContext).TypeName;
729
+ }
730
+ if (node.location !== undefined) {
731
+ result.location = node.location;
732
+ }
733
+ return { TypeCast: result };
734
+ }
735
+ CollateClause(node: any, context: any): {
736
+ CollateClause: any;
737
+ } {
738
+ const result: any = {};
739
+ if (node.arg !== undefined) {
740
+ result.arg = this.transform(node.arg as any, context);
741
+ }
742
+ if (node.collname !== undefined) {
743
+ result.collname = Array.isArray(node.collname)
744
+ ? node.collname.map((item: any) => this.transform(item as any, context))
745
+ : this.transform(node.collname as any, context);
746
+ }
747
+ if (node.location !== undefined) {
748
+ result.location = node.location;
749
+ }
750
+ return { CollateClause: result };
751
+ }
752
+ BooleanTest(node: any, context: any): {
753
+ BooleanTest: any;
754
+ } {
755
+ const result: any = {};
756
+ if (node.xpr !== undefined) {
757
+ result.xpr = this.transform(node.xpr as any, context);
758
+ }
759
+ if (node.arg !== undefined) {
760
+ result.arg = this.transform(node.arg as any, context);
761
+ }
762
+ if (node.booltesttype !== undefined) {
763
+ result.booltesttype = node.booltesttype;
764
+ }
765
+ if (node.location !== undefined) {
766
+ result.location = node.location;
767
+ }
768
+ return { BooleanTest: result };
769
+ }
770
+ NullTest(node: any, context: any): {
771
+ NullTest: any;
772
+ } {
773
+ const result: any = {};
774
+ if (node.xpr !== undefined) {
775
+ result.xpr = this.transform(node.xpr as any, context);
776
+ }
777
+ if (node.arg !== undefined) {
778
+ result.arg = this.transform(node.arg as any, context);
779
+ }
780
+ if (node.nulltesttype !== undefined) {
781
+ result.nulltesttype = node.nulltesttype;
782
+ }
783
+ if (node.argisrow !== undefined) {
784
+ result.argisrow = node.argisrow;
785
+ }
786
+ if (node.location !== undefined) {
787
+ result.location = node.location;
788
+ }
789
+ return { NullTest: result };
790
+ }
791
+ String(node: any, context: any): {
792
+ String: any;
793
+ } {
794
+ const result: any = { ...node };
795
+ return { String: result };
796
+ }
797
+ Integer(node: any, context: any): {
798
+ Integer: any;
799
+ } {
800
+ const result: any = { ...node };
801
+ return { Integer: result };
802
+ }
803
+ Float(node: any, context: any): {
804
+ Float: any;
805
+ } {
806
+ const result: any = { ...node };
807
+ return { Float: result };
808
+ }
809
+ Boolean(node: any, context: any): {
810
+ Boolean: any;
811
+ } {
812
+ const result: any = { ...node };
813
+ return { Boolean: result };
814
+ }
815
+ BitString(node: any, context: any): {
816
+ BitString: any;
817
+ } {
818
+ const result: any = { ...node };
819
+ return { BitString: result };
820
+ }
821
+ Null(node: any, context: any): {
822
+ Null: {};
823
+ } {
824
+ return { Null: {} };
825
+ }
826
+ List(node: any, context: any): {
827
+ List: any;
828
+ } {
829
+ const result: any = {};
830
+ if (node.items !== undefined) {
831
+ result.items = Array.isArray(node.items)
832
+ ? node.items.map((item: any) => {
833
+ const transformed = this.transform(item as any, context);
834
+ if (transformed === null) {
835
+ return {};
836
+ }
837
+ return transformed;
838
+ })
839
+ : this.transform(node.items as any, context);
840
+ }
841
+ return { List: result };
842
+ }
843
+ CreateStmt(node: any, context: any): {
844
+ CreateStmt: any;
845
+ } {
846
+ const result: any = {};
847
+ if (node.relation !== undefined) {
848
+ result.relation = this.transform(node.relation as any, context);
849
+ }
850
+ if (node.tableElts !== undefined) {
851
+ result.tableElts = Array.isArray(node.tableElts)
852
+ ? node.tableElts.map((item: any) => this.transform(item as any, context))
853
+ : this.transform(node.tableElts as any, context);
854
+ }
855
+ if (node.inhRelations !== undefined) {
856
+ result.inhRelations = Array.isArray(node.inhRelations)
857
+ ? node.inhRelations.map((item: any) => this.transform(item as any, context))
858
+ : this.transform(node.inhRelations as any, context);
859
+ }
860
+ if (node.partbound !== undefined) {
861
+ result.partbound = this.transform(node.partbound as any, context);
862
+ }
863
+ if (node.partspec !== undefined) {
864
+ // Handle partspec transformation directly since it's a plain object, not a wrapped node
865
+ const partspec: any = { ...node.partspec };
866
+ if (partspec.strategy !== undefined) {
867
+ const strategyMap: Record<string, string> = {
868
+ 'range': 'PARTITION_STRATEGY_RANGE',
869
+ 'list': 'PARTITION_STRATEGY_LIST',
870
+ 'hash': 'PARTITION_STRATEGY_HASH'
871
+ };
872
+ partspec.strategy = strategyMap[partspec.strategy] || partspec.strategy;
873
+ }
874
+ if (partspec.partParams !== undefined) {
875
+ partspec.partParams = Array.isArray(partspec.partParams)
876
+ ? partspec.partParams.map((item: any) => this.transform(item as any, context))
877
+ : this.transform(partspec.partParams as any, context);
878
+ }
879
+ result.partspec = partspec;
880
+ }
881
+ if (node.ofTypename !== undefined) {
882
+ result.ofTypename = this.transform(node.ofTypename as any, context);
883
+ }
884
+ if (node.constraints !== undefined) {
885
+ result.constraints = Array.isArray(node.constraints)
886
+ ? node.constraints.map((item: any) => this.transform(item as any, context))
887
+ : this.transform(node.constraints as any, context);
888
+ }
889
+ if (node.options !== undefined) {
890
+ result.options = Array.isArray(node.options)
891
+ ? node.options.map((item: any) => this.transform(item as any, context))
892
+ : this.transform(node.options as any, context);
893
+ }
894
+ if (node.oncommit !== undefined) {
895
+ result.oncommit = node.oncommit;
896
+ }
897
+ if (node.tablespacename !== undefined) {
898
+ result.tablespacename = node.tablespacename;
899
+ }
900
+ if (node.accessMethod !== undefined) {
901
+ result.accessMethod = node.accessMethod;
902
+ }
903
+ if (node.if_not_exists !== undefined) {
904
+ result.if_not_exists = node.if_not_exists;
905
+ }
906
+ return { CreateStmt: result };
907
+ }
908
+ ColumnDef(node: any, context: any): {
909
+ ColumnDef: any;
910
+ } {
911
+ const result: any = {};
912
+ if (node.colname !== undefined) {
913
+ result.colname = node.colname;
914
+ }
915
+ if (node.typeName !== undefined) {
916
+ const transformedTypeName = this.transform({ TypeName: node.typeName } as any, context);
917
+ result.typeName = transformedTypeName.TypeName;
918
+ }
919
+ if (node.inhcount !== undefined) {
920
+ result.inhcount = node.inhcount;
921
+ }
922
+ if (node.is_local !== undefined) {
923
+ result.is_local = node.is_local;
924
+ }
925
+ if (node.is_not_null !== undefined) {
926
+ result.is_not_null = node.is_not_null;
927
+ }
928
+ if (node.is_from_type !== undefined) {
929
+ result.is_from_type = node.is_from_type;
930
+ }
931
+ if (node.storage !== undefined) {
932
+ result.storage = node.storage;
933
+ }
934
+ if (node.raw_default !== undefined) {
935
+ result.raw_default = this.transform(node.raw_default as any, context);
936
+ }
937
+ if (node.cooked_default !== undefined) {
938
+ result.cooked_default = this.transform(node.cooked_default as any, context);
939
+ }
940
+ if (node.identity !== undefined) {
941
+ result.identity = node.identity;
942
+ }
943
+ if (node.identitySequence !== undefined) {
944
+ result.identitySequence = this.transform(node.identitySequence as any, context);
945
+ }
946
+ if (node.generated !== undefined) {
947
+ result.generated = node.generated;
948
+ }
949
+ if (node.collClause !== undefined) {
950
+ result.collClause = this.transform(node.collClause as any, context);
951
+ }
952
+ if (node.collOid !== undefined) {
953
+ result.collOid = node.collOid;
954
+ }
955
+ if (node.constraints !== undefined) {
956
+ result.constraints = Array.isArray(node.constraints)
957
+ ? node.constraints.map((item: any) => this.transform(item as any, context))
958
+ : this.transform(node.constraints as any, context);
959
+ }
960
+ if (node.fdwoptions !== undefined) {
961
+ result.fdwoptions = Array.isArray(node.fdwoptions)
962
+ ? node.fdwoptions.map((item: any) => this.transform(item as any, context))
963
+ : this.transform(node.fdwoptions as any, context);
964
+ }
965
+ if (node.location !== undefined) {
966
+ result.location = node.location;
967
+ }
968
+ return { ColumnDef: result };
969
+ }
970
+ Constraint(node: any, context: any): {
971
+ Constraint: any;
972
+ } {
973
+ const result: any = {};
974
+ if (node.contype !== undefined) {
975
+ result.contype = node.contype;
976
+ }
977
+ if (node.conname !== undefined) {
978
+ result.conname = node.conname;
979
+ }
980
+ if (node.deferrable !== undefined) {
981
+ result.deferrable = node.deferrable;
982
+ }
983
+ if (node.initdeferred !== undefined) {
984
+ result.initdeferred = node.initdeferred;
985
+ }
986
+ if (node.location !== undefined) {
987
+ result.location = node.location;
988
+ }
989
+ if (node.is_no_inherit !== undefined) {
990
+ result.is_no_inherit = node.is_no_inherit;
991
+ }
992
+ if (node.raw_expr !== undefined) {
993
+ result.raw_expr = this.transform(node.raw_expr as any, context);
994
+ }
995
+ if (node.cooked_expr !== undefined) {
996
+ result.cooked_expr = node.cooked_expr;
997
+ }
998
+ if (node.generated_when !== undefined) {
999
+ result.generated_when = node.generated_when;
1000
+ }
1001
+ if (node.keys !== undefined) {
1002
+ result.keys = Array.isArray(node.keys)
1003
+ ? node.keys.map((item: any) => this.transform(item as any, context))
1004
+ : this.transform(node.keys as any, context);
1005
+ }
1006
+ if (node.including !== undefined) {
1007
+ result.including = Array.isArray(node.including)
1008
+ ? node.including.map((item: any) => this.transform(item as any, context))
1009
+ : this.transform(node.including as any, context);
1010
+ }
1011
+ if (node.exclusions !== undefined) {
1012
+ result.exclusions = Array.isArray(node.exclusions)
1013
+ ? node.exclusions.map((item: any) => this.transform(item as any, context))
1014
+ : this.transform(node.exclusions as any, context);
1015
+ }
1016
+ if (node.options !== undefined) {
1017
+ result.options = Array.isArray(node.options)
1018
+ ? node.options.map((item: any) => this.transform(item as any, context))
1019
+ : this.transform(node.options as any, context);
1020
+ }
1021
+ if (node.indexname !== undefined) {
1022
+ result.indexname = node.indexname;
1023
+ }
1024
+ if (node.indexspace !== undefined) {
1025
+ result.indexspace = node.indexspace;
1026
+ }
1027
+ if (node.reset_default_tblspc !== undefined) {
1028
+ result.reset_default_tblspc = node.reset_default_tblspc;
1029
+ }
1030
+ if (node.access_method !== undefined) {
1031
+ result.access_method = node.access_method;
1032
+ }
1033
+ if (node.where_clause !== undefined) {
1034
+ result.where_clause = this.transform(node.where_clause as any, context);
1035
+ }
1036
+ if (node.pktable !== undefined) {
1037
+ result.pktable = this.transform(node.pktable as any, context);
1038
+ }
1039
+ if (node.fk_attrs !== undefined) {
1040
+ result.fk_attrs = Array.isArray(node.fk_attrs)
1041
+ ? node.fk_attrs.map((item: any) => this.transform(item as any, context))
1042
+ : this.transform(node.fk_attrs as any, context);
1043
+ }
1044
+ if (node.pk_attrs !== undefined) {
1045
+ result.pk_attrs = Array.isArray(node.pk_attrs)
1046
+ ? node.pk_attrs.map((item: any) => this.transform(item as any, context))
1047
+ : this.transform(node.pk_attrs as any, context);
1048
+ }
1049
+ if (node.fk_matchtype !== undefined) {
1050
+ result.fk_matchtype = node.fk_matchtype;
1051
+ }
1052
+ if (node.fk_upd_action !== undefined) {
1053
+ result.fk_upd_action = node.fk_upd_action;
1054
+ }
1055
+ if (node.fk_del_action !== undefined) {
1056
+ result.fk_del_action = node.fk_del_action;
1057
+ }
1058
+ if (node.old_conpfeqop !== undefined) {
1059
+ result.old_conpfeqop = Array.isArray(node.old_conpfeqop)
1060
+ ? node.old_conpfeqop.map((item: any) => this.transform(item as any, context))
1061
+ : this.transform(node.old_conpfeqop as any, context);
1062
+ }
1063
+ if (node.old_pktable_oid !== undefined) {
1064
+ result.old_pktable_oid = node.old_pktable_oid;
1065
+ }
1066
+ if (node.skip_validation !== undefined) {
1067
+ result.skip_validation = node.skip_validation;
1068
+ }
1069
+ if (node.initially_valid !== undefined) {
1070
+ result.initially_valid = node.initially_valid;
1071
+ }
1072
+ if (node.nulls_not_distinct !== undefined) {
1073
+ result.nulls_not_distinct = node.nulls_not_distinct;
1074
+ }
1075
+ return { Constraint: result };
1076
+ }
1077
+ SubLink(node: any, context: any): {
1078
+ SubLink: any;
1079
+ } {
1080
+ const result: any = {};
1081
+ if (node.xpr !== undefined) {
1082
+ result.xpr = this.transform(node.xpr as any, context);
1083
+ }
1084
+ if (node.subLinkType !== undefined) {
1085
+ result.subLinkType = node.subLinkType;
1086
+ }
1087
+ if (node.subLinkId !== undefined) {
1088
+ result.subLinkId = node.subLinkId;
1089
+ }
1090
+ if (node.testexpr !== undefined) {
1091
+ result.testexpr = this.transform(node.testexpr as any, context);
1092
+ }
1093
+ if (node.operName !== undefined) {
1094
+ result.operName = Array.isArray(node.operName)
1095
+ ? node.operName.map((item: any) => this.transform(item as any, context))
1096
+ : this.transform(node.operName as any, context);
1097
+ }
1098
+ if (node.subselect !== undefined) {
1099
+ result.subselect = this.transform(node.subselect as any, context);
1100
+ }
1101
+ if (node.location !== undefined) {
1102
+ result.location = node.location;
1103
+ }
1104
+ return { SubLink: result };
1105
+ }
1106
+ CaseWhen(node: any, context: any): {
1107
+ CaseWhen: any;
1108
+ } {
1109
+ const result: any = {};
1110
+ if (node.xpr !== undefined) {
1111
+ result.xpr = this.transform(node.xpr as any, context);
1112
+ }
1113
+ if (node.expr !== undefined) {
1114
+ result.expr = this.transform(node.expr as any, context);
1115
+ }
1116
+ if (node.result !== undefined) {
1117
+ result.result = this.transform(node.result as any, context);
1118
+ }
1119
+ if (node.location !== undefined) {
1120
+ result.location = node.location;
1121
+ }
1122
+ return { CaseWhen: result };
1123
+ }
1124
+ WindowDef(node: any, context: any): {
1125
+ WindowDef: any;
1126
+ } {
1127
+ const result: any = {};
1128
+ if (node.name !== undefined) {
1129
+ result.name = node.name;
1130
+ }
1131
+ if (node.refname !== undefined) {
1132
+ result.refname = node.refname;
1133
+ }
1134
+ if (node.partitionClause !== undefined) {
1135
+ result.partitionClause = Array.isArray(node.partitionClause)
1136
+ ? node.partitionClause.map((item: any) => this.transform(item as any, context))
1137
+ : this.transform(node.partitionClause as any, context);
1138
+ }
1139
+ if (node.orderClause !== undefined) {
1140
+ result.orderClause = Array.isArray(node.orderClause)
1141
+ ? node.orderClause.map((item: any) => this.transform(item as any, context))
1142
+ : this.transform(node.orderClause as any, context);
1143
+ }
1144
+ if (node.frameOptions !== undefined) {
1145
+ result.frameOptions = node.frameOptions;
1146
+ }
1147
+ if (node.startOffset !== undefined) {
1148
+ result.startOffset = this.transform(node.startOffset as any, context);
1149
+ }
1150
+ if (node.endOffset !== undefined) {
1151
+ result.endOffset = this.transform(node.endOffset as any, context);
1152
+ }
1153
+ if (node.location !== undefined) {
1154
+ result.location = node.location;
1155
+ }
1156
+ return { WindowDef: result };
1157
+ }
1158
+ SortBy(node: any, context: any): {
1159
+ SortBy: any;
1160
+ } {
1161
+ const result: any = {};
1162
+ if (node.node !== undefined) {
1163
+ result.node = this.transform(node.node as any, context);
1164
+ }
1165
+ if (node.sortby_dir !== undefined) {
1166
+ result.sortby_dir = node.sortby_dir;
1167
+ }
1168
+ if (node.sortby_nulls !== undefined) {
1169
+ result.sortby_nulls = node.sortby_nulls;
1170
+ }
1171
+ if (node.useOp !== undefined) {
1172
+ result.useOp = Array.isArray(node.useOp)
1173
+ ? node.useOp.map((item: any) => this.transform(item as any, context))
1174
+ : this.transform(node.useOp as any, context);
1175
+ }
1176
+ if (node.location !== undefined) {
1177
+ result.location = node.location;
1178
+ }
1179
+ return { SortBy: result };
1180
+ }
1181
+ GroupingSet(node: any, context: any): {
1182
+ GroupingSet: any;
1183
+ } {
1184
+ const result: any = {};
1185
+ if (node.kind !== undefined) {
1186
+ result.kind = node.kind;
1187
+ }
1188
+ if (node.content !== undefined) {
1189
+ result.content = Array.isArray(node.content)
1190
+ ? node.content.map((item: any) => this.transform(item as any, context))
1191
+ : this.transform(node.content as any, context);
1192
+ }
1193
+ if (node.location !== undefined) {
1194
+ result.location = node.location;
1195
+ }
1196
+ return { GroupingSet: result };
1197
+ }
1198
+ CommonTableExpr(node: any, context: any): {
1199
+ CommonTableExpr: any;
1200
+ } {
1201
+ const result: any = {};
1202
+ if (node.ctename !== undefined) {
1203
+ result.ctename = node.ctename;
1204
+ }
1205
+ if (node.aliascolnames !== undefined) {
1206
+ result.aliascolnames = Array.isArray(node.aliascolnames)
1207
+ ? node.aliascolnames.map((item: any) => this.transform(item as any, context))
1208
+ : this.transform(node.aliascolnames as any, context);
1209
+ }
1210
+ if (node.ctematerialized !== undefined) {
1211
+ result.ctematerialized = node.ctematerialized;
1212
+ }
1213
+ if (node.ctequery !== undefined) {
1214
+ result.ctequery = this.transform(node.ctequery as any, context);
1215
+ }
1216
+ if (node.location !== undefined) {
1217
+ result.location = node.location;
1218
+ }
1219
+ if (node.cterecursive !== undefined) {
1220
+ result.cterecursive = node.cterecursive;
1221
+ }
1222
+ if (node.cterefcount !== undefined) {
1223
+ result.cterefcount = node.cterefcount;
1224
+ }
1225
+ if (node.ctecolnames !== undefined) {
1226
+ result.ctecolnames = Array.isArray(node.ctecolnames)
1227
+ ? node.ctecolnames.map((item: any) => this.transform(item as any, context))
1228
+ : this.transform(node.ctecolnames as any, context);
1229
+ }
1230
+ if (node.ctecoltypes !== undefined) {
1231
+ result.ctecoltypes = Array.isArray(node.ctecoltypes)
1232
+ ? node.ctecoltypes.map((item: any) => this.transform(item as any, context))
1233
+ : this.transform(node.ctecoltypes as any, context);
1234
+ }
1235
+ if (node.ctecoltypmods !== undefined) {
1236
+ result.ctecoltypmods = Array.isArray(node.ctecoltypmods)
1237
+ ? node.ctecoltypmods.map((item: any) => this.transform(item as any, context))
1238
+ : this.transform(node.ctecoltypmods as any, context);
1239
+ }
1240
+ if (node.ctecolcollations !== undefined) {
1241
+ result.ctecolcollations = Array.isArray(node.ctecolcollations)
1242
+ ? node.ctecolcollations.map((item: any) => this.transform(item as any, context))
1243
+ : this.transform(node.ctecolcollations as any, context);
1244
+ }
1245
+ return { CommonTableExpr: result };
1246
+ }
1247
+ ParamRef(node: any, context: any): {
1248
+ ParamRef: any;
1249
+ } {
1250
+ const result: any = {};
1251
+ if (node.number !== undefined) {
1252
+ result.number = node.number;
1253
+ }
1254
+ if (node.location !== undefined) {
1255
+ result.location = node.location;
1256
+ }
1257
+ return { ParamRef: result };
1258
+ }
1259
+ LockingClause(node: any, context: any): {
1260
+ LockingClause: any;
1261
+ } {
1262
+ const result: any = {};
1263
+ if (node.lockedRels !== undefined) {
1264
+ result.lockedRels = Array.isArray(node.lockedRels)
1265
+ ? node.lockedRels.map((item: any) => this.transform(item as any, context))
1266
+ : this.transform(node.lockedRels as any, context);
1267
+ }
1268
+ if (node.strength !== undefined) {
1269
+ result.strength = node.strength;
1270
+ }
1271
+ if (node.waitPolicy !== undefined) {
1272
+ result.waitPolicy = node.waitPolicy;
1273
+ }
1274
+ return { LockingClause: result };
1275
+ }
1276
+ MinMaxExpr(node: any, context: any): {
1277
+ MinMaxExpr: any;
1278
+ } {
1279
+ const result: any = {};
1280
+ if (node.xpr !== undefined) {
1281
+ result.xpr = this.transform(node.xpr as any, context);
1282
+ }
1283
+ if (node.minmaxtype !== undefined) {
1284
+ result.minmaxtype = node.minmaxtype;
1285
+ }
1286
+ if (node.minmaxcollid !== undefined) {
1287
+ result.minmaxcollid = node.minmaxcollid;
1288
+ }
1289
+ if (node.inputcollid !== undefined) {
1290
+ result.inputcollid = node.inputcollid;
1291
+ }
1292
+ if (node.op !== undefined) {
1293
+ result.op = node.op;
1294
+ }
1295
+ if (node.args !== undefined) {
1296
+ result.args = Array.isArray(node.args)
1297
+ ? node.args.map((item: any) => this.transform(item as any, context))
1298
+ : this.transform(node.args as any, context);
1299
+ }
1300
+ if (node.location !== undefined) {
1301
+ result.location = node.location;
1302
+ }
1303
+ return { MinMaxExpr: result };
1304
+ }
1305
+ RowExpr(node: any, context: any): {
1306
+ RowExpr: any;
1307
+ } {
1308
+ const result: any = {};
1309
+ if (node.xpr !== undefined) {
1310
+ result.xpr = this.transform(node.xpr as any, context);
1311
+ }
1312
+ if (node.args !== undefined) {
1313
+ result.args = Array.isArray(node.args)
1314
+ ? node.args.map((item: any) => this.transform(item as any, context))
1315
+ : this.transform(node.args as any, context);
1316
+ }
1317
+ if (node.row_typeid !== undefined) {
1318
+ result.row_typeid = node.row_typeid;
1319
+ }
1320
+ if (node.row_format !== undefined) {
1321
+ result.row_format = node.row_format;
1322
+ }
1323
+ if (node.colnames !== undefined) {
1324
+ result.colnames = Array.isArray(node.colnames)
1325
+ ? node.colnames.map((item: any) => this.transform(item as any, context))
1326
+ : this.transform(node.colnames as any, context);
1327
+ }
1328
+ if (node.location !== undefined) {
1329
+ result.location = node.location;
1330
+ }
1331
+ return { RowExpr: result };
1332
+ }
1333
+ OpExpr(node: any, context: any): {
1334
+ OpExpr: any;
1335
+ } {
1336
+ const result: any = {};
1337
+ if (node.xpr !== undefined) {
1338
+ result.xpr = this.transform(node.xpr as any, context);
1339
+ }
1340
+ if (node.opno !== undefined) {
1341
+ result.opno = node.opno;
1342
+ }
1343
+ if (node.opfuncid !== undefined) {
1344
+ result.opfuncid = node.opfuncid;
1345
+ }
1346
+ if (node.opresulttype !== undefined) {
1347
+ result.opresulttype = node.opresulttype;
1348
+ }
1349
+ if (node.opretset !== undefined) {
1350
+ result.opretset = node.opretset;
1351
+ }
1352
+ if (node.opcollid !== undefined) {
1353
+ result.opcollid = node.opcollid;
1354
+ }
1355
+ if (node.inputcollid !== undefined) {
1356
+ result.inputcollid = node.inputcollid;
1357
+ }
1358
+ if (node.args !== undefined) {
1359
+ result.args = Array.isArray(node.args)
1360
+ ? node.args.map((item: any) => this.transform(item as any, context))
1361
+ : this.transform(node.args as any, context);
1362
+ }
1363
+ if (node.location !== undefined) {
1364
+ result.location = node.location;
1365
+ }
1366
+ return { OpExpr: result };
1367
+ }
1368
+ DistinctExpr(node: any, context: any): {
1369
+ DistinctExpr: any;
1370
+ } {
1371
+ const result: any = {};
1372
+ if (node.xpr !== undefined) {
1373
+ result.xpr = this.transform(node.xpr as any, context);
1374
+ }
1375
+ if (node.opno !== undefined) {
1376
+ result.opno = node.opno;
1377
+ }
1378
+ if (node.opfuncid !== undefined) {
1379
+ result.opfuncid = node.opfuncid;
1380
+ }
1381
+ if (node.opresulttype !== undefined) {
1382
+ result.opresulttype = node.opresulttype;
1383
+ }
1384
+ if (node.opretset !== undefined) {
1385
+ result.opretset = node.opretset;
1386
+ }
1387
+ if (node.opcollid !== undefined) {
1388
+ result.opcollid = node.opcollid;
1389
+ }
1390
+ if (node.inputcollid !== undefined) {
1391
+ result.inputcollid = node.inputcollid;
1392
+ }
1393
+ if (node.args !== undefined) {
1394
+ result.args = Array.isArray(node.args)
1395
+ ? node.args.map((item: any) => this.transform(item as any, context))
1396
+ : this.transform(node.args as any, context);
1397
+ }
1398
+ if (node.location !== undefined) {
1399
+ result.location = node.location;
1400
+ }
1401
+ return { DistinctExpr: result };
1402
+ }
1403
+ NullIfExpr(node: any, context: any): {
1404
+ NullIfExpr: any;
1405
+ } {
1406
+ const result: any = {};
1407
+ if (node.xpr !== undefined) {
1408
+ result.xpr = this.transform(node.xpr as any, context);
1409
+ }
1410
+ if (node.opno !== undefined) {
1411
+ result.opno = node.opno;
1412
+ }
1413
+ if (node.opfuncid !== undefined) {
1414
+ result.opfuncid = node.opfuncid;
1415
+ }
1416
+ if (node.opresulttype !== undefined) {
1417
+ result.opresulttype = node.opresulttype;
1418
+ }
1419
+ if (node.opretset !== undefined) {
1420
+ result.opretset = node.opretset;
1421
+ }
1422
+ if (node.opcollid !== undefined) {
1423
+ result.opcollid = node.opcollid;
1424
+ }
1425
+ if (node.inputcollid !== undefined) {
1426
+ result.inputcollid = node.inputcollid;
1427
+ }
1428
+ if (node.args !== undefined) {
1429
+ result.args = Array.isArray(node.args)
1430
+ ? node.args.map((item: any) => this.transform(item as any, context))
1431
+ : this.transform(node.args as any, context);
1432
+ }
1433
+ if (node.location !== undefined) {
1434
+ result.location = node.location;
1435
+ }
1436
+ return { NullIfExpr: result };
1437
+ }
1438
+ ScalarArrayOpExpr(node: any, context: any): {
1439
+ ScalarArrayOpExpr: any;
1440
+ } {
1441
+ const result: any = {};
1442
+ if (node.xpr !== undefined) {
1443
+ result.xpr = this.transform(node.xpr as any, context);
1444
+ }
1445
+ if (node.opno !== undefined) {
1446
+ result.opno = node.opno;
1447
+ }
1448
+ if (node.opfuncid !== undefined) {
1449
+ result.opfuncid = node.opfuncid;
1450
+ }
1451
+ if (node.hashfuncid !== undefined) {
1452
+ result.hashfuncid = node.hashfuncid;
1453
+ }
1454
+ if (node.useOr !== undefined) {
1455
+ result.useOr = node.useOr;
1456
+ }
1457
+ if (node.inputcollid !== undefined) {
1458
+ result.inputcollid = node.inputcollid;
1459
+ }
1460
+ if (node.args !== undefined) {
1461
+ result.args = Array.isArray(node.args)
1462
+ ? node.args.map((item: any) => this.transform(item as any, context))
1463
+ : this.transform(node.args as any, context);
1464
+ }
1465
+ if (node.location !== undefined) {
1466
+ result.location = node.location;
1467
+ }
1468
+ return { ScalarArrayOpExpr: result };
1469
+ }
1470
+ Aggref(node: any, context: any): {
1471
+ Aggref: any;
1472
+ } {
1473
+ const result: any = {};
1474
+ if (node.xpr !== undefined) {
1475
+ result.xpr = this.transform(node.xpr as any, context);
1476
+ }
1477
+ if (node.aggfnoid !== undefined) {
1478
+ result.aggfnoid = node.aggfnoid;
1479
+ }
1480
+ if (node.aggtype !== undefined) {
1481
+ result.aggtype = node.aggtype;
1482
+ }
1483
+ if (node.aggcollid !== undefined) {
1484
+ result.aggcollid = node.aggcollid;
1485
+ }
1486
+ if (node.inputcollid !== undefined) {
1487
+ result.inputcollid = node.inputcollid;
1488
+ }
1489
+ if (node.aggtranstype !== undefined) {
1490
+ result.aggtranstype = node.aggtranstype;
1491
+ }
1492
+ if (node.aggargtypes !== undefined) {
1493
+ result.aggargtypes = Array.isArray(node.aggargtypes)
1494
+ ? node.aggargtypes.map((item: any) => this.transform(item as any, context))
1495
+ : this.transform(node.aggargtypes as any, context);
1496
+ }
1497
+ if (node.aggdirectargs !== undefined) {
1498
+ result.aggdirectargs = Array.isArray(node.aggdirectargs)
1499
+ ? node.aggdirectargs.map((item: any) => this.transform(item as any, context))
1500
+ : this.transform(node.aggdirectargs as any, context);
1501
+ }
1502
+ if (node.args !== undefined) {
1503
+ result.args = Array.isArray(node.args)
1504
+ ? node.args.map((item: any) => this.transform(item as any, context))
1505
+ : this.transform(node.args as any, context);
1506
+ }
1507
+ if (node.aggorder !== undefined) {
1508
+ result.aggorder = Array.isArray(node.aggorder)
1509
+ ? node.aggorder.map((item: any) => this.transform(item as any, context))
1510
+ : this.transform(node.aggorder as any, context);
1511
+ }
1512
+ if (node.aggdistinct !== undefined) {
1513
+ result.aggdistinct = Array.isArray(node.aggdistinct)
1514
+ ? node.aggdistinct.map((item: any) => this.transform(item as any, context))
1515
+ : this.transform(node.aggdistinct as any, context);
1516
+ }
1517
+ if (node.aggfilter !== undefined) {
1518
+ result.aggfilter = this.transform(node.aggfilter as any, context);
1519
+ }
1520
+ if (node.aggstar !== undefined) {
1521
+ result.aggstar = node.aggstar;
1522
+ }
1523
+ if (node.aggvariadic !== undefined) {
1524
+ result.aggvariadic = node.aggvariadic;
1525
+ }
1526
+ if (node.aggkind !== undefined) {
1527
+ result.aggkind = node.aggkind;
1528
+ }
1529
+ if (node.agglevelsup !== undefined) {
1530
+ result.agglevelsup = node.agglevelsup;
1531
+ }
1532
+ if (node.aggsplit !== undefined) {
1533
+ result.aggsplit = node.aggsplit;
1534
+ }
1535
+ if (node.aggno !== undefined) {
1536
+ result.aggno = node.aggno;
1537
+ }
1538
+ if (node.aggtransno !== undefined) {
1539
+ result.aggtransno = node.aggtransno;
1540
+ }
1541
+ if (node.location !== undefined) {
1542
+ result.location = node.location;
1543
+ }
1544
+ return { Aggref: result };
1545
+ }
1546
+ WindowFunc(node: any, context: any): {
1547
+ WindowFunc: any;
1548
+ } {
1549
+ const result: any = {};
1550
+ if (node.xpr !== undefined) {
1551
+ result.xpr = this.transform(node.xpr as any, context);
1552
+ }
1553
+ if (node.winfnoid !== undefined) {
1554
+ result.winfnoid = node.winfnoid;
1555
+ }
1556
+ if (node.wintype !== undefined) {
1557
+ result.wintype = node.wintype;
1558
+ }
1559
+ if (node.wincollid !== undefined) {
1560
+ result.wincollid = node.wincollid;
1561
+ }
1562
+ if (node.inputcollid !== undefined) {
1563
+ result.inputcollid = node.inputcollid;
1564
+ }
1565
+ if (node.args !== undefined) {
1566
+ result.args = Array.isArray(node.args)
1567
+ ? node.args.map((item: any) => this.transform(item as any, context))
1568
+ : this.transform(node.args as any, context);
1569
+ }
1570
+ if (node.aggfilter !== undefined) {
1571
+ result.aggfilter = this.transform(node.aggfilter as any, context);
1572
+ }
1573
+ if (node.winref !== undefined) {
1574
+ result.winref = node.winref;
1575
+ }
1576
+ if (node.winstar !== undefined) {
1577
+ result.winstar = node.winstar;
1578
+ }
1579
+ if (node.winagg !== undefined) {
1580
+ result.winagg = node.winagg;
1581
+ }
1582
+ if (node.location !== undefined) {
1583
+ result.location = node.location;
1584
+ }
1585
+ return { WindowFunc: result };
1586
+ }
1587
+ FieldSelect(node: any, context: any): {
1588
+ FieldSelect: any;
1589
+ } {
1590
+ const result: any = {};
1591
+ if (node.xpr !== undefined) {
1592
+ result.xpr = this.transform(node.xpr as any, context);
1593
+ }
1594
+ if (node.arg !== undefined) {
1595
+ result.arg = this.transform(node.arg as any, context);
1596
+ }
1597
+ if (node.fieldnum !== undefined) {
1598
+ result.fieldnum = node.fieldnum;
1599
+ }
1600
+ if (node.resulttype !== undefined) {
1601
+ result.resulttype = node.resulttype;
1602
+ }
1603
+ if (node.resulttypmod !== undefined) {
1604
+ result.resulttypmod = node.resulttypmod;
1605
+ }
1606
+ if (node.resultcollid !== undefined) {
1607
+ result.resultcollid = node.resultcollid;
1608
+ }
1609
+ return { FieldSelect: result };
1610
+ }
1611
+ RelabelType(node: any, context: any): {
1612
+ RelabelType: any;
1613
+ } {
1614
+ const result: any = {};
1615
+ if (node.xpr !== undefined) {
1616
+ result.xpr = this.transform(node.xpr as any, context);
1617
+ }
1618
+ if (node.arg !== undefined) {
1619
+ result.arg = this.transform(node.arg as any, context);
1620
+ }
1621
+ if (node.resulttype !== undefined) {
1622
+ result.resulttype = node.resulttype;
1623
+ }
1624
+ if (node.resulttypmod !== undefined) {
1625
+ result.resulttypmod = node.resulttypmod;
1626
+ }
1627
+ if (node.resultcollid !== undefined) {
1628
+ result.resultcollid = node.resultcollid;
1629
+ }
1630
+ if (node.relabelformat !== undefined) {
1631
+ result.relabelformat = node.relabelformat;
1632
+ }
1633
+ if (node.location !== undefined) {
1634
+ result.location = node.location;
1635
+ }
1636
+ return { RelabelType: result };
1637
+ }
1638
+ CoerceViaIO(node: any, context: any): {
1639
+ CoerceViaIO: any;
1640
+ } {
1641
+ const result: any = {};
1642
+ if (node.xpr !== undefined) {
1643
+ result.xpr = this.transform(node.xpr as any, context);
1644
+ }
1645
+ if (node.arg !== undefined) {
1646
+ result.arg = this.transform(node.arg as any, context);
1647
+ }
1648
+ if (node.resulttype !== undefined) {
1649
+ result.resulttype = node.resulttype;
1650
+ }
1651
+ if (node.resultcollid !== undefined) {
1652
+ result.resultcollid = node.resultcollid;
1653
+ }
1654
+ if (node.coerceformat !== undefined) {
1655
+ result.coerceformat = node.coerceformat;
1656
+ }
1657
+ if (node.location !== undefined) {
1658
+ result.location = node.location;
1659
+ }
1660
+ return { CoerceViaIO: result };
1661
+ }
1662
+ ArrayCoerceExpr(node: any, context: any): {
1663
+ ArrayCoerceExpr: any;
1664
+ } {
1665
+ const result: any = {};
1666
+ if (node.xpr !== undefined) {
1667
+ result.xpr = this.transform(node.xpr as any, context);
1668
+ }
1669
+ if (node.arg !== undefined) {
1670
+ result.arg = this.transform(node.arg as any, context);
1671
+ }
1672
+ if (node.elemexpr !== undefined) {
1673
+ result.elemexpr = this.transform(node.elemexpr as any, context);
1674
+ }
1675
+ if (node.resulttype !== undefined) {
1676
+ result.resulttype = node.resulttype;
1677
+ }
1678
+ if (node.resulttypmod !== undefined) {
1679
+ result.resulttypmod = node.resulttypmod;
1680
+ }
1681
+ if (node.resultcollid !== undefined) {
1682
+ result.resultcollid = node.resultcollid;
1683
+ }
1684
+ if (node.coerceformat !== undefined) {
1685
+ result.coerceformat = node.coerceformat;
1686
+ }
1687
+ if (node.location !== undefined) {
1688
+ result.location = node.location;
1689
+ }
1690
+ return { ArrayCoerceExpr: result };
1691
+ }
1692
+ ConvertRowtypeExpr(node: any, context: any): {
1693
+ ConvertRowtypeExpr: any;
1694
+ } {
1695
+ const result: any = {};
1696
+ if (node.xpr !== undefined) {
1697
+ result.xpr = this.transform(node.xpr as any, context);
1698
+ }
1699
+ if (node.arg !== undefined) {
1700
+ result.arg = this.transform(node.arg as any, context);
1701
+ }
1702
+ if (node.resulttype !== undefined) {
1703
+ result.resulttype = node.resulttype;
1704
+ }
1705
+ if (node.convertformat !== undefined) {
1706
+ result.convertformat = node.convertformat;
1707
+ }
1708
+ if (node.location !== undefined) {
1709
+ result.location = node.location;
1710
+ }
1711
+ return { ConvertRowtypeExpr: result };
1712
+ }
1713
+ NamedArgExpr(node: any, context: any): {
1714
+ NamedArgExpr: any;
1715
+ } {
1716
+ const result: any = {};
1717
+ if (node.xpr !== undefined) {
1718
+ result.xpr = this.transform(node.xpr as any, context);
1719
+ }
1720
+ if (node.arg !== undefined) {
1721
+ result.arg = this.transform(node.arg as any, context);
1722
+ }
1723
+ if (node.name !== undefined) {
1724
+ result.name = node.name;
1725
+ }
1726
+ if (node.argnumber !== undefined) {
1727
+ result.argnumber = node.argnumber;
1728
+ }
1729
+ if (node.location !== undefined) {
1730
+ result.location = node.location;
1731
+ }
1732
+ return { NamedArgExpr: result };
1733
+ }
1734
+ ViewStmt(node: any, context: any): {
1735
+ ViewStmt: any;
1736
+ } {
1737
+ const result: any = {};
1738
+ if (node.view !== undefined) {
1739
+ result.view = this.transform(node.view as any, context);
1740
+ }
1741
+ if (node.aliases !== undefined) {
1742
+ result.aliases = Array.isArray(node.aliases)
1743
+ ? node.aliases.map((item: any) => this.transform(item as any, context))
1744
+ : this.transform(node.aliases as any, context);
1745
+ }
1746
+ if (node.query !== undefined) {
1747
+ result.query = this.transform(node.query as any, context);
1748
+ }
1749
+ if (node.replace !== undefined) {
1750
+ result.replace = node.replace;
1751
+ }
1752
+ if (node.options !== undefined) {
1753
+ result.options = Array.isArray(node.options)
1754
+ ? node.options.map((item: any) => this.transform(item as any, context))
1755
+ : this.transform(node.options as any, context);
1756
+ }
1757
+ if (node.withCheckOption !== undefined) {
1758
+ result.withCheckOption = node.withCheckOption;
1759
+ }
1760
+ return { ViewStmt: result };
1761
+ }
1762
+ IndexStmt(node: any, context: any): {
1763
+ IndexStmt: any;
1764
+ } {
1765
+ const result: any = {};
1766
+ if (node.idxname !== undefined) {
1767
+ result.idxname = node.idxname;
1768
+ }
1769
+ if (node.relation !== undefined) {
1770
+ result.relation = this.transform(node.relation as any, context);
1771
+ }
1772
+ if (node.accessMethod !== undefined) {
1773
+ result.accessMethod = node.accessMethod;
1774
+ }
1775
+ if (node.tableSpace !== undefined) {
1776
+ result.tableSpace = node.tableSpace;
1777
+ }
1778
+ if (node.indexParams !== undefined) {
1779
+ result.indexParams = Array.isArray(node.indexParams)
1780
+ ? node.indexParams.map((item: any) => this.transform(item as any, context))
1781
+ : this.transform(node.indexParams as any, context);
1782
+ }
1783
+ if (node.indexIncludingParams !== undefined) {
1784
+ result.indexIncludingParams = Array.isArray(node.indexIncludingParams)
1785
+ ? node.indexIncludingParams.map((item: any) => this.transform(item as any, context))
1786
+ : this.transform(node.indexIncludingParams as any, context);
1787
+ }
1788
+ if (node.options !== undefined) {
1789
+ result.options = Array.isArray(node.options)
1790
+ ? node.options.map((item: any) => this.transform(item as any, context))
1791
+ : this.transform(node.options as any, context);
1792
+ }
1793
+ if (node.whereClause !== undefined) {
1794
+ result.whereClause = this.transform(node.whereClause as any, context);
1795
+ }
1796
+ if (node.excludeOpNames !== undefined) {
1797
+ result.excludeOpNames = Array.isArray(node.excludeOpNames)
1798
+ ? node.excludeOpNames.map((item: any) => this.transform(item as any, context))
1799
+ : this.transform(node.excludeOpNames as any, context);
1800
+ }
1801
+ if (node.idxcomment !== undefined) {
1802
+ result.idxcomment = node.idxcomment;
1803
+ }
1804
+ if (node.indexOid !== undefined) {
1805
+ result.indexOid = node.indexOid;
1806
+ }
1807
+ if (node.oldNode !== undefined) {
1808
+ result.oldNode = node.oldNode;
1809
+ }
1810
+ if (node.oldCreateSubid !== undefined) {
1811
+ result.oldCreateSubid = node.oldCreateSubid;
1812
+ }
1813
+ if (node.oldFirstRelfilenodeSubid !== undefined) {
1814
+ result.oldFirstRelfilenodeSubid = node.oldFirstRelfilenodeSubid;
1815
+ }
1816
+ if (node.unique !== undefined) {
1817
+ result.unique = node.unique;
1818
+ }
1819
+ if (node.nulls_not_distinct !== undefined) {
1820
+ result.nulls_not_distinct = node.nulls_not_distinct;
1821
+ }
1822
+ if (node.primary !== undefined) {
1823
+ result.primary = node.primary;
1824
+ }
1825
+ if (node.isconstraint !== undefined) {
1826
+ result.isconstraint = node.isconstraint;
1827
+ }
1828
+ if (node.deferrable !== undefined) {
1829
+ result.deferrable = node.deferrable;
1830
+ }
1831
+ if (node.initdeferred !== undefined) {
1832
+ result.initdeferred = node.initdeferred;
1833
+ }
1834
+ if (node.transformed !== undefined) {
1835
+ result.transformed = node.transformed;
1836
+ }
1837
+ if (node.concurrent !== undefined) {
1838
+ result.concurrent = node.concurrent;
1839
+ }
1840
+ if (node.if_not_exists !== undefined) {
1841
+ result.if_not_exists = node.if_not_exists;
1842
+ }
1843
+ if (node.reset_default_tblspc !== undefined) {
1844
+ result.reset_default_tblspc = node.reset_default_tblspc;
1845
+ }
1846
+ return { IndexStmt: result };
1847
+ }
1848
+ IndexElem(node: any, context: any): {
1849
+ IndexElem: any;
1850
+ } {
1851
+ const result: any = {};
1852
+ if (node.name !== undefined) {
1853
+ result.name = node.name;
1854
+ }
1855
+ if (node.expr !== undefined) {
1856
+ result.expr = this.transform(node.expr as any, context);
1857
+ }
1858
+ if (node.indexcolname !== undefined) {
1859
+ result.indexcolname = node.indexcolname;
1860
+ }
1861
+ if (node.collation !== undefined) {
1862
+ result.collation = Array.isArray(node.collation)
1863
+ ? node.collation.map((item: any) => this.transform(item as any, context))
1864
+ : this.transform(node.collation as any, context);
1865
+ }
1866
+ if (node.opclass !== undefined) {
1867
+ result.opclass = Array.isArray(node.opclass)
1868
+ ? node.opclass.map((item: any) => this.transform(item as any, context))
1869
+ : this.transform(node.opclass as any, context);
1870
+ }
1871
+ if (node.opclassopts !== undefined) {
1872
+ result.opclassopts = Array.isArray(node.opclassopts)
1873
+ ? node.opclassopts.map((item: any) => this.transform(item as any, context))
1874
+ : this.transform(node.opclassopts as any, context);
1875
+ }
1876
+ if (node.ordering !== undefined) {
1877
+ result.ordering = node.ordering;
1878
+ }
1879
+ if (node.nulls_ordering !== undefined) {
1880
+ result.nulls_ordering = node.nulls_ordering;
1881
+ }
1882
+ return { IndexElem: result };
1883
+ }
1884
+ PartitionElem(node: any, context: any): {
1885
+ PartitionElem: any;
1886
+ } {
1887
+ const result: any = {};
1888
+ if (node.name !== undefined) {
1889
+ result.name = node.name;
1890
+ }
1891
+ if (node.expr !== undefined) {
1892
+ result.expr = this.transform(node.expr as any, context);
1893
+ }
1894
+ if (node.collation !== undefined) {
1895
+ result.collation = Array.isArray(node.collation)
1896
+ ? node.collation.map((item: any) => this.transform(item as any, context))
1897
+ : this.transform(node.collation as any, context);
1898
+ }
1899
+ if (node.opclass !== undefined) {
1900
+ result.opclass = Array.isArray(node.opclass)
1901
+ ? node.opclass.map((item: any) => this.transform(item as any, context))
1902
+ : this.transform(node.opclass as any, context);
1903
+ }
1904
+ if (node.location !== undefined) {
1905
+ result.location = node.location;
1906
+ }
1907
+ return { PartitionElem: result };
1908
+ }
1909
+ PartitionCmd(node: any, context: any): {
1910
+ PartitionCmd: any;
1911
+ } {
1912
+ const result: any = {};
1913
+ if (node.name !== undefined) {
1914
+ result.name = this.transform(node.name as any, context);
1915
+ }
1916
+ if (node.bound !== undefined) {
1917
+ result.bound = this.transform(node.bound as any, context);
1918
+ }
1919
+ if (node.concurrent !== undefined) {
1920
+ result.concurrent = node.concurrent;
1921
+ }
1922
+ return { PartitionCmd: result };
1923
+ }
1924
+ JoinExpr(node: any, context: any): {
1925
+ JoinExpr: any;
1926
+ } {
1927
+ const result: any = {};
1928
+ if (node.jointype !== undefined) {
1929
+ result.jointype = node.jointype;
1930
+ }
1931
+ if (node.isNatural !== undefined) {
1932
+ result.isNatural = node.isNatural;
1933
+ }
1934
+ if (node.larg !== undefined) {
1935
+ result.larg = this.transform(node.larg as any, context);
1936
+ }
1937
+ if (node.rarg !== undefined) {
1938
+ result.rarg = this.transform(node.rarg as any, context);
1939
+ }
1940
+ if (node.usingClause !== undefined) {
1941
+ result.usingClause = Array.isArray(node.usingClause)
1942
+ ? node.usingClause.map((item: any) => this.transform(item as any, context))
1943
+ : this.transform(node.usingClause as any, context);
1944
+ }
1945
+ if (node.join_using_alias !== undefined) {
1946
+ result.join_using_alias = this.transform(node.join_using_alias as any, context);
1947
+ }
1948
+ if (node.quals !== undefined) {
1949
+ result.quals = this.transform(node.quals as any, context);
1950
+ }
1951
+ if (node.alias !== undefined) {
1952
+ result.alias = this.transform(node.alias as any, context);
1953
+ }
1954
+ if (node.rtindex !== undefined) {
1955
+ result.rtindex = node.rtindex;
1956
+ }
1957
+ return { JoinExpr: result };
1958
+ }
1959
+ FromExpr(node: any, context: any): {
1960
+ FromExpr: any;
1961
+ } {
1962
+ const result: any = {};
1963
+ if (node.fromlist !== undefined) {
1964
+ result.fromlist = Array.isArray(node.fromlist)
1965
+ ? node.fromlist.map((item: any) => this.transform(item as any, context))
1966
+ : this.transform(node.fromlist as any, context);
1967
+ }
1968
+ if (node.quals !== undefined) {
1969
+ result.quals = this.transform(node.quals as any, context);
1970
+ }
1971
+ return { FromExpr: result };
1972
+ }
1973
+ TransactionStmt(node: any, context: any): {
1974
+ TransactionStmt: any;
1975
+ } {
1976
+ const result: any = {};
1977
+ if (node.kind !== undefined) {
1978
+ result.kind = node.kind;
1979
+ }
1980
+ if (node.options !== undefined) {
1981
+ result.options = Array.isArray(node.options)
1982
+ ? node.options.map((item: any) => this.transform(item as any, context))
1983
+ : this.transform(node.options as any, context);
1984
+ }
1985
+ if (node.savepoint_name !== undefined) {
1986
+ result.savepoint_name = node.savepoint_name;
1987
+ }
1988
+ if (node.gid !== undefined) {
1989
+ result.gid = node.gid;
1990
+ }
1991
+ if (node.chain !== undefined) {
1992
+ result.chain = node.chain;
1993
+ }
1994
+ return { TransactionStmt: result };
1995
+ }
1996
+ VariableSetStmt(node: any, context: any): {
1997
+ VariableSetStmt: any;
1998
+ } {
1999
+ const result: any = {};
2000
+ if (node.kind !== undefined) {
2001
+ result.kind = node.kind;
2002
+ }
2003
+ if (node.name !== undefined) {
2004
+ result.name = node.name;
2005
+ }
2006
+ if (node.args !== undefined) {
2007
+ result.args = Array.isArray(node.args)
2008
+ ? node.args.map((item: any) => this.transform(item as any, context))
2009
+ : this.transform(node.args as any, context);
2010
+ }
2011
+ if (node.is_local !== undefined) {
2012
+ result.is_local = node.is_local;
2013
+ }
2014
+ return { VariableSetStmt: result };
2015
+ }
2016
+ VariableShowStmt(node: any, context: any): {
2017
+ VariableShowStmt: any;
2018
+ } {
2019
+ const result: any = {};
2020
+ if (node.name !== undefined) {
2021
+ result.name = node.name;
2022
+ }
2023
+ return { VariableShowStmt: result };
2024
+ }
2025
+ CreateSchemaStmt(node: any, context: any): {
2026
+ CreateSchemaStmt: any;
2027
+ } {
2028
+ const result: any = {};
2029
+ if (node.schemaname !== undefined) {
2030
+ result.schemaname = node.schemaname;
2031
+ }
2032
+ if (node.authrole !== undefined) {
2033
+ result.authrole = this.transform(node.authrole as any, context);
2034
+ }
2035
+ if (node.schemaElts !== undefined) {
2036
+ result.schemaElts = Array.isArray(node.schemaElts)
2037
+ ? node.schemaElts.map((item: any) => this.transform(item as any, context))
2038
+ : this.transform(node.schemaElts as any, context);
2039
+ }
2040
+ if (node.if_not_exists !== undefined) {
2041
+ result.if_not_exists = node.if_not_exists;
2042
+ }
2043
+ return { CreateSchemaStmt: result };
2044
+ }
2045
+ RoleSpec(node: any, context: any): {
2046
+ RoleSpec: any;
2047
+ } {
2048
+ const result: any = {};
2049
+ if (node.roletype !== undefined) {
2050
+ result.roletype = node.roletype;
2051
+ }
2052
+ if (node.rolename !== undefined) {
2053
+ result.rolename = node.rolename;
2054
+ }
2055
+ if (node.location !== undefined) {
2056
+ result.location = node.location;
2057
+ }
2058
+ return { RoleSpec: result };
2059
+ }
2060
+ DropStmt(node: any, context: any): {
2061
+ DropStmt: any;
2062
+ } {
2063
+ const result: any = {};
2064
+ if (node.objects !== undefined) {
2065
+ result.objects = Array.isArray(node.objects)
2066
+ ? node.objects.map((item: any) => this.transform(item as any, context))
2067
+ : this.transform(node.objects as any, context);
2068
+ }
2069
+ if (node.removeType !== undefined) {
2070
+ result.removeType = node.removeType;
2071
+ }
2072
+ if (node.behavior !== undefined) {
2073
+ result.behavior = node.behavior;
2074
+ }
2075
+ if (node.missing_ok !== undefined) {
2076
+ result.missing_ok = node.missing_ok;
2077
+ }
2078
+ if (node.concurrent !== undefined) {
2079
+ result.concurrent = node.concurrent;
2080
+ }
2081
+ return { DropStmt: result };
2082
+ }
2083
+ TruncateStmt(node: any, context: any): {
2084
+ TruncateStmt: any;
2085
+ } {
2086
+ const result: any = {};
2087
+ if (node.relations !== undefined) {
2088
+ result.relations = Array.isArray(node.relations)
2089
+ ? node.relations.map((item: any) => this.transform(item as any, context))
2090
+ : this.transform(node.relations as any, context);
2091
+ }
2092
+ if (node.restart_seqs !== undefined) {
2093
+ result.restart_seqs = node.restart_seqs;
2094
+ }
2095
+ if (node.behavior !== undefined) {
2096
+ result.behavior = node.behavior;
2097
+ }
2098
+ return { TruncateStmt: result };
2099
+ }
2100
+ ReturnStmt(node: any, context: any): {
2101
+ ReturnStmt: any;
2102
+ } {
2103
+ const result: any = {};
2104
+ if (node.returnval !== undefined) {
2105
+ result.returnval = this.transform(node.returnval as any, context);
2106
+ }
2107
+ return { ReturnStmt: result };
2108
+ }
2109
+ PLAssignStmt(node: any, context: any): {
2110
+ PLAssignStmt: any;
2111
+ } {
2112
+ const result: any = {};
2113
+ if (node.name !== undefined) {
2114
+ result.name = node.name;
2115
+ }
2116
+ if (node.indirection !== undefined) {
2117
+ result.indirection = Array.isArray(node.indirection)
2118
+ ? node.indirection.map((item: any) => this.transform(item as any, context))
2119
+ : this.transform(node.indirection as any, context);
2120
+ }
2121
+ if (node.nnames !== undefined) {
2122
+ result.nnames = node.nnames;
2123
+ }
2124
+ if (node.val !== undefined) {
2125
+ result.val = this.transform(node.val as any, context);
2126
+ }
2127
+ if (node.location !== undefined) {
2128
+ result.location = node.location;
2129
+ }
2130
+ return { PLAssignStmt: result };
2131
+ }
2132
+ CopyStmt(node: any, context: any): {
2133
+ CopyStmt: any;
2134
+ } {
2135
+ const result: any = {};
2136
+ if (node.relation !== undefined) {
2137
+ result.relation = this.transform(node.relation as any, context);
2138
+ }
2139
+ if (node.query !== undefined) {
2140
+ result.query = this.transform(node.query as any, context);
2141
+ }
2142
+ if (node.attlist !== undefined) {
2143
+ result.attlist = Array.isArray(node.attlist)
2144
+ ? node.attlist.map((item: any) => this.transform(item as any, context))
2145
+ : this.transform(node.attlist as any, context);
2146
+ }
2147
+ if (node.is_from !== undefined) {
2148
+ result.is_from = node.is_from;
2149
+ }
2150
+ if (node.is_program !== undefined) {
2151
+ result.is_program = node.is_program;
2152
+ }
2153
+ if (node.filename !== undefined) {
2154
+ result.filename = node.filename;
2155
+ }
2156
+ if (node.options !== undefined) {
2157
+ result.options = Array.isArray(node.options)
2158
+ ? node.options.map((item: any) => this.transform(item as any, context))
2159
+ : this.transform(node.options as any, context);
2160
+ }
2161
+ if (node.whereClause !== undefined) {
2162
+ result.whereClause = this.transform(node.whereClause as any, context);
2163
+ }
2164
+ return { CopyStmt: result };
2165
+ }
2166
+ AlterTableStmt(node: any, context: any): {
2167
+ AlterTableStmt: any;
2168
+ } {
2169
+ const result: any = {};
2170
+ if (node.relation !== undefined) {
2171
+ result.relation = this.transform(node.relation as any, context);
2172
+ }
2173
+ if (node.cmds !== undefined) {
2174
+ result.cmds = Array.isArray(node.cmds)
2175
+ ? node.cmds.map((item: any) => this.transform(item as any, context))
2176
+ : this.transform(node.cmds as any, context);
2177
+ }
2178
+ if (node.objtype !== undefined) {
2179
+ result.objtype = node.objtype;
2180
+ }
2181
+ if (node.missing_ok !== undefined) {
2182
+ result.missing_ok = node.missing_ok;
2183
+ }
2184
+ return { AlterTableStmt: result };
2185
+ }
2186
+ AlterTableCmd(node: any, context: any): {
2187
+ AlterTableCmd: any;
2188
+ } {
2189
+ const result: any = {};
2190
+ if (node.subtype !== undefined) {
2191
+ result.subtype = node.subtype;
2192
+ }
2193
+ if (node.name !== undefined) {
2194
+ result.name = node.name;
2195
+ }
2196
+ if (node.num !== undefined) {
2197
+ result.num = node.num;
2198
+ }
2199
+ if (node.newowner !== undefined) {
2200
+ result.newowner = this.transform(node.newowner as any, context);
2201
+ }
2202
+ if (node.def !== undefined) {
2203
+ result.def = this.transform(node.def as any, context);
2204
+ }
2205
+ if (node.behavior !== undefined) {
2206
+ result.behavior = node.behavior;
2207
+ }
2208
+ if (node.missing_ok !== undefined) {
2209
+ result.missing_ok = node.missing_ok;
2210
+ }
2211
+ return { AlterTableCmd: result };
2212
+ }
2213
+ CreateFunctionStmt(node: any, context: any): {
2214
+ CreateFunctionStmt: any;
2215
+ } {
2216
+ const result: any = {};
2217
+ if (node.is_procedure !== undefined) {
2218
+ result.is_procedure = node.is_procedure;
2219
+ }
2220
+ if (node.replace !== undefined) {
2221
+ result.replace = node.replace;
2222
+ }
2223
+ if (node.funcname !== undefined) {
2224
+ result.funcname = Array.isArray(node.funcname)
2225
+ ? node.funcname.map((item: any) => this.transform(item as any, context))
2226
+ : this.transform(node.funcname as any, context);
2227
+ }
2228
+ if (node.parameters !== undefined) {
2229
+ result.parameters = Array.isArray(node.parameters)
2230
+ ? node.parameters.map((item: any) => this.transform(item as any, context))
2231
+ : this.transform(node.parameters as any, context);
2232
+ }
2233
+ if (node.returnType !== undefined) {
2234
+ result.returnType = this.transform(node.returnType as any, context);
2235
+ }
2236
+ if (node.options !== undefined) {
2237
+ result.options = Array.isArray(node.options)
2238
+ ? node.options.map((item: any) => this.transform(item as any, context))
2239
+ : this.transform(node.options as any, context);
2240
+ }
2241
+ if (node.sql_body !== undefined) {
2242
+ result.sql_body = this.transform(node.sql_body as any, context);
2243
+ }
2244
+ return { CreateFunctionStmt: result };
2245
+ }
2246
+ FunctionParameter(node: any, context: any): {
2247
+ FunctionParameter: any;
2248
+ } {
2249
+ const result: any = {};
2250
+ if (node.name !== undefined) {
2251
+ result.name = node.name;
2252
+ }
2253
+ if (node.argType !== undefined) {
2254
+ result.argType = this.transform(node.argType as any, context);
2255
+ }
2256
+ if (node.mode !== undefined) {
2257
+ result.mode = node.mode;
2258
+ }
2259
+ if (node.defexpr !== undefined) {
2260
+ result.defexpr = this.transform(node.defexpr as any, context);
2261
+ }
2262
+ return { FunctionParameter: result };
2263
+ }
2264
+ CompositeTypeStmt(node: any, context: any): {
2265
+ CompositeTypeStmt: any;
2266
+ } {
2267
+ const result: any = {};
2268
+ if (node.typevar !== undefined) {
2269
+ result.typevar = this.transform(node.typevar as any, context);
2270
+ }
2271
+ if (node.coldeflist !== undefined) {
2272
+ result.coldeflist = Array.isArray(node.coldeflist)
2273
+ ? node.coldeflist.map((item: any) => this.transform(item as any, context))
2274
+ : this.transform(node.coldeflist as any, context);
2275
+ }
2276
+ return { CompositeTypeStmt: result };
2277
+ }
2278
+ DoStmt(node: any, context: any): {
2279
+ DoStmt: any;
2280
+ } {
2281
+ const result: any = {};
2282
+ if (node.args !== undefined) {
2283
+ result.args = Array.isArray(node.args)
2284
+ ? node.args.map((item: any) => this.transform(item as any, context))
2285
+ : this.transform(node.args as any, context);
2286
+ }
2287
+ return { DoStmt: result };
2288
+ }
2289
+ DefineStmt(node: any, context: any): {
2290
+ DefineStmt: any;
2291
+ } {
2292
+ const result: any = {};
2293
+ if (node.kind !== undefined) {
2294
+ result.kind = node.kind;
2295
+ }
2296
+ if (node.oldstyle !== undefined) {
2297
+ result.oldstyle = node.oldstyle;
2298
+ }
2299
+ if (node.defnames !== undefined) {
2300
+ result.defnames = Array.isArray(node.defnames)
2301
+ ? node.defnames.map((item: any) => this.transform(item as any, context))
2302
+ : this.transform(node.defnames as any, context);
2303
+ }
2304
+ if (node.args !== undefined) {
2305
+ result.args = Array.isArray(node.args)
2306
+ ? node.args.map((item: any) => this.transform(item as any, context))
2307
+ : this.transform(node.args as any, context);
2308
+ }
2309
+ if (node.definition !== undefined) {
2310
+ result.definition = Array.isArray(node.definition)
2311
+ ? node.definition.map((item: any) => this.transform(item as any, context))
2312
+ : this.transform(node.definition as any, context);
2313
+ }
2314
+ if (node.if_not_exists !== undefined) {
2315
+ result.if_not_exists = node.if_not_exists;
2316
+ }
2317
+ if (node.replace !== undefined) {
2318
+ result.replace = node.replace;
2319
+ }
2320
+ return { DefineStmt: result };
2321
+ }
2322
+ RangeSubselect(node: any, context: any): {
2323
+ RangeSubselect: any;
2324
+ } {
2325
+ const result: any = {};
2326
+ if (node.lateral !== undefined) {
2327
+ result.lateral = node.lateral;
2328
+ }
2329
+ if (node.subquery !== undefined) {
2330
+ result.subquery = this.transform(node.subquery as any, context);
2331
+ }
2332
+ if (node.alias !== undefined) {
2333
+ result.alias = this.transform(node.alias as any, context);
2334
+ }
2335
+ return { RangeSubselect: result };
2336
+ }
2337
+ CreateEnumStmt(node: any, context: any): {
2338
+ CreateEnumStmt: any;
2339
+ } {
2340
+ const result: any = {};
2341
+ if (node.typeName !== undefined) {
2342
+ result.typeName = Array.isArray(node.typeName)
2343
+ ? node.typeName.map((item: any) => this.transform(item as any, context))
2344
+ : this.transform(node.typeName as any, context);
2345
+ }
2346
+ if (node.vals !== undefined) {
2347
+ result.vals = Array.isArray(node.vals)
2348
+ ? node.vals.map((item: any) => this.transform(item as any, context))
2349
+ : this.transform(node.vals as any, context);
2350
+ }
2351
+ return { CreateEnumStmt: result };
2352
+ }
2353
+ CreateDomainStmt(node: any, context: any): {
2354
+ CreateDomainStmt: any;
2355
+ } {
2356
+ const result: any = {};
2357
+ if (node.domainname !== undefined) {
2358
+ result.domainname = Array.isArray(node.domainname)
2359
+ ? node.domainname.map((item: any) => this.transform(item as any, context))
2360
+ : this.transform(node.domainname as any, context);
2361
+ }
2362
+ if (node.typeName !== undefined) {
2363
+ result.typeName = this.transform(node.typeName as any, context);
2364
+ }
2365
+ if (node.collClause !== undefined) {
2366
+ result.collClause = this.transform(node.collClause as any, context);
2367
+ }
2368
+ if (node.constraints !== undefined) {
2369
+ result.constraints = Array.isArray(node.constraints)
2370
+ ? node.constraints.map((item: any) => this.transform(item as any, context))
2371
+ : this.transform(node.constraints as any, context);
2372
+ }
2373
+ return { CreateDomainStmt: result };
2374
+ }
2375
+ CreateRoleStmt(node: any, context: any): {
2376
+ CreateRoleStmt: any;
2377
+ } {
2378
+ const result: any = {};
2379
+ if (node.stmt_type !== undefined) {
2380
+ result.stmt_type = node.stmt_type;
2381
+ }
2382
+ if (node.role !== undefined) {
2383
+ result.role = node.role;
2384
+ }
2385
+ if (node.options !== undefined) {
2386
+ result.options = Array.isArray(node.options)
2387
+ ? node.options.map((item: any) => this.transform(item as any, context))
2388
+ : this.transform(node.options as any, context);
2389
+ }
2390
+ return { CreateRoleStmt: result };
2391
+ }
2392
+ DefElem(node: any, context: any): {
2393
+ DefElem: any;
2394
+ } {
2395
+ const result: any = {};
2396
+ if (node.defnamespace !== undefined) {
2397
+ result.defnamespace = node.defnamespace;
2398
+ }
2399
+ if (node.defname !== undefined) {
2400
+ result.defname = node.defname;
2401
+ }
2402
+ if (node.arg !== undefined) {
2403
+ result.arg = this.transform(node.arg as any, context);
2404
+ }
2405
+ if (node.defaction !== undefined) {
2406
+ result.defaction = node.defaction;
2407
+ }
2408
+ if (node.location !== undefined) {
2409
+ result.location = node.location;
2410
+ }
2411
+ return { DefElem: result };
2412
+ }
2413
+ CreateTableSpaceStmt(node: any, context: any): {
2414
+ CreateTableSpaceStmt: any;
2415
+ } {
2416
+ const result: any = {};
2417
+ if (node.tablespacename !== undefined) {
2418
+ result.tablespacename = node.tablespacename;
2419
+ }
2420
+ if (node.owner !== undefined) {
2421
+ result.owner = this.transform(node.owner as any, context);
2422
+ }
2423
+ if (node.location !== undefined) {
2424
+ result.location = node.location;
2425
+ }
2426
+ if (node.options !== undefined) {
2427
+ result.options = Array.isArray(node.options)
2428
+ ? node.options.map((item: any) => this.transform(item as any, context))
2429
+ : this.transform(node.options as any, context);
2430
+ }
2431
+ return { CreateTableSpaceStmt: result };
2432
+ }
2433
+ DropTableSpaceStmt(node: any, context: any): {
2434
+ DropTableSpaceStmt: any;
2435
+ } {
2436
+ const result: any = {};
2437
+ if (node.tablespacename !== undefined) {
2438
+ result.tablespacename = node.tablespacename;
2439
+ }
2440
+ if (node.missing_ok !== undefined) {
2441
+ result.missing_ok = node.missing_ok;
2442
+ }
2443
+ return { DropTableSpaceStmt: result };
2444
+ }
2445
+ AlterTableSpaceOptionsStmt(node: any, context: any): {
2446
+ AlterTableSpaceOptionsStmt: any;
2447
+ } {
2448
+ const result: any = {};
2449
+ if (node.tablespacename !== undefined) {
2450
+ result.tablespacename = node.tablespacename;
2451
+ }
2452
+ if (node.options !== undefined) {
2453
+ result.options = Array.isArray(node.options)
2454
+ ? node.options.map((item: any) => this.transform(item as any, context))
2455
+ : this.transform(node.options as any, context);
2456
+ }
2457
+ if (node.isReset !== undefined) {
2458
+ result.isReset = node.isReset;
2459
+ }
2460
+ return { AlterTableSpaceOptionsStmt: result };
2461
+ }
2462
+ CreateExtensionStmt(node: any, context: any): {
2463
+ CreateExtensionStmt: any;
2464
+ } {
2465
+ const result: any = {};
2466
+ if (node.extname !== undefined) {
2467
+ result.extname = node.extname;
2468
+ }
2469
+ if (node.if_not_exists !== undefined) {
2470
+ result.if_not_exists = node.if_not_exists;
2471
+ }
2472
+ if (node.options !== undefined) {
2473
+ result.options = Array.isArray(node.options)
2474
+ ? node.options.map((item: any) => this.transform(item as any, context))
2475
+ : this.transform(node.options as any, context);
2476
+ }
2477
+ return { CreateExtensionStmt: result };
2478
+ }
2479
+ AlterExtensionStmt(node: any, context: any): {
2480
+ AlterExtensionStmt: any;
2481
+ } {
2482
+ const result: any = {};
2483
+ if (node.extname !== undefined) {
2484
+ result.extname = node.extname;
2485
+ }
2486
+ if (node.options !== undefined) {
2487
+ result.options = Array.isArray(node.options)
2488
+ ? node.options.map((item: any) => this.transform(item as any, context))
2489
+ : this.transform(node.options as any, context);
2490
+ }
2491
+ return { AlterExtensionStmt: result };
2492
+ }
2493
+ CreateFdwStmt(node: any, context: any): {
2494
+ CreateFdwStmt: any;
2495
+ } {
2496
+ const result: any = { ...node };
2497
+ return { CreateFdwStmt: result };
2498
+ }
2499
+ SetOperationStmt(node: any, context: any): {
2500
+ SetOperationStmt: any;
2501
+ } {
2502
+ const result: any = { ...node };
2503
+ return { SetOperationStmt: result };
2504
+ }
2505
+ ReplicaIdentityStmt(node: any, context: any): {
2506
+ ReplicaIdentityStmt: any;
2507
+ } {
2508
+ const result: any = { ...node };
2509
+ return { ReplicaIdentityStmt: result };
2510
+ }
2511
+ AlterCollationStmt(node: any, context: any): {
2512
+ AlterCollationStmt: any;
2513
+ } {
2514
+ const result: any = { ...node };
2515
+ return { AlterCollationStmt: result };
2516
+ }
2517
+ AlterDomainStmt(node: any, context: any): {
2518
+ AlterDomainStmt: any;
2519
+ } {
2520
+ const result: any = { ...node };
2521
+ return { AlterDomainStmt: result };
2522
+ }
2523
+ PrepareStmt(node: any, context: any): {
2524
+ PrepareStmt: any;
2525
+ } {
2526
+ const result: any = { ...node };
2527
+ return { PrepareStmt: result };
2528
+ }
2529
+ ExecuteStmt(node: any, context: any): {
2530
+ ExecuteStmt: any;
2531
+ } {
2532
+ const result: any = { ...node };
2533
+ return { ExecuteStmt: result };
2534
+ }
2535
+ DeallocateStmt(node: any, context: any): {
2536
+ DeallocateStmt: any;
2537
+ } {
2538
+ const result: any = { ...node };
2539
+ return { DeallocateStmt: result };
2540
+ }
2541
+ NotifyStmt(node: any, context: any): {
2542
+ NotifyStmt: any;
2543
+ } {
2544
+ const result: any = { ...node };
2545
+ return { NotifyStmt: result };
2546
+ }
2547
+ ListenStmt(node: any, context: any): {
2548
+ ListenStmt: any;
2549
+ } {
2550
+ const result: any = { ...node };
2551
+ return { ListenStmt: result };
2552
+ }
2553
+ UnlistenStmt(node: any, context: any): {
2554
+ UnlistenStmt: any;
2555
+ } {
2556
+ const result: any = { ...node };
2557
+ return { UnlistenStmt: result };
2558
+ }
2559
+ CheckPointStmt(node: any, context: any): {
2560
+ CheckPointStmt: any;
2561
+ } {
2562
+ const result: any = { ...node };
2563
+ return { CheckPointStmt: result };
2564
+ }
2565
+ LoadStmt(node: any, context: any): {
2566
+ LoadStmt: any;
2567
+ } {
2568
+ const result: any = { ...node };
2569
+ return { LoadStmt: result };
2570
+ }
2571
+ DiscardStmt(node: any, context: any): {
2572
+ DiscardStmt: any;
2573
+ } {
2574
+ const result: any = { ...node };
2575
+ return { DiscardStmt: result };
2576
+ }
2577
+ CommentStmt(node: any, context: any): {
2578
+ CommentStmt: any;
2579
+ } {
2580
+ const result: any = {};
2581
+ if (node.objtype !== undefined) {
2582
+ result.objtype = node.objtype;
2583
+ }
2584
+ if (node.object !== undefined) {
2585
+ result.object = this.transform(node.object as any, context);
2586
+ }
2587
+ if (node.comment !== undefined) {
2588
+ result.comment = node.comment;
2589
+ }
2590
+ return { CommentStmt: result };
2591
+ }
2592
+ LockStmt(node: any, context: any): {
2593
+ LockStmt: any;
2594
+ } {
2595
+ const result: any = { ...node };
2596
+ return { LockStmt: result };
2597
+ }
2598
+ CreatePolicyStmt(node: any, context: any): {
2599
+ CreatePolicyStmt: any;
2600
+ } {
2601
+ const result: any = { ...node };
2602
+ return { CreatePolicyStmt: result };
2603
+ }
2604
+ AlterPolicyStmt(node: any, context: any): {
2605
+ AlterPolicyStmt: any;
2606
+ } {
2607
+ const result: any = { ...node };
2608
+ return { AlterPolicyStmt: result };
2609
+ }
2610
+ CreateUserMappingStmt(node: any, context: any): {
2611
+ CreateUserMappingStmt: any;
2612
+ } {
2613
+ const result: any = { ...node };
2614
+ return { CreateUserMappingStmt: result };
2615
+ }
2616
+ CreateStatsStmt(node: any, context: any): {
2617
+ CreateStatsStmt: any;
2618
+ } {
2619
+ const result: any = { ...node };
2620
+ return { CreateStatsStmt: result };
2621
+ }
2622
+ StatsElem(node: any, context: any): {
2623
+ StatsElem: any;
2624
+ } {
2625
+ const result: any = { ...node };
2626
+ return { StatsElem: result };
2627
+ }
2628
+ CreatePublicationStmt(node: any, context: any): {
2629
+ CreatePublicationStmt: any;
2630
+ } {
2631
+ const result: any = { ...node };
2632
+ return { CreatePublicationStmt: result };
2633
+ }
2634
+ CreateSubscriptionStmt(node: any, context: any): {
2635
+ CreateSubscriptionStmt: any;
2636
+ } {
2637
+ const result: any = { ...node };
2638
+ return { CreateSubscriptionStmt: result };
2639
+ }
2640
+ AlterPublicationStmt(node: any, context: any): {
2641
+ AlterPublicationStmt: any;
2642
+ } {
2643
+ const result: any = { ...node };
2644
+ return { AlterPublicationStmt: result };
2645
+ }
2646
+ AlterSubscriptionStmt(node: any, context: any): {
2647
+ AlterSubscriptionStmt: any;
2648
+ } {
2649
+ const result: any = { ...node };
2650
+ return { AlterSubscriptionStmt: result };
2651
+ }
2652
+ DropSubscriptionStmt(node: any, context: any): {
2653
+ DropSubscriptionStmt: any;
2654
+ } {
2655
+ const result: any = { ...node };
2656
+ return { DropSubscriptionStmt: result };
2657
+ }
2658
+ InlineCodeBlock(node: any, context: any): {
2659
+ InlineCodeBlock: any;
2660
+ } {
2661
+ const result: any = { ...node };
2662
+ return { InlineCodeBlock: result };
2663
+ }
2664
+ CallContext(node: any, context: any): {
2665
+ CallContext: any;
2666
+ } {
2667
+ const result: any = { ...node };
2668
+ return { CallContext: result };
2669
+ }
2670
+ ConstraintsSetStmt(node: any, context: any): {
2671
+ ConstraintsSetStmt: any;
2672
+ } {
2673
+ const result: any = { ...node };
2674
+ return { ConstraintsSetStmt: result };
2675
+ }
2676
+ AlterSystemStmt(node: any, context: any): {
2677
+ AlterSystemStmt: any;
2678
+ } {
2679
+ const result: any = { ...node };
2680
+ return { AlterSystemStmt: result };
2681
+ }
2682
+ VacuumRelation(node: any, context: any): {
2683
+ VacuumRelation: any;
2684
+ } {
2685
+ const result: any = { ...node };
2686
+ return { VacuumRelation: result };
2687
+ }
2688
+ DropOwnedStmt(node: any, context: any): {
2689
+ DropOwnedStmt: any;
2690
+ } {
2691
+ const result: any = { ...node };
2692
+ return { DropOwnedStmt: result };
2693
+ }
2694
+ ReassignOwnedStmt(node: any, context: any): {
2695
+ ReassignOwnedStmt: any;
2696
+ } {
2697
+ const result: any = { ...node };
2698
+ return { ReassignOwnedStmt: result };
2699
+ }
2700
+ AlterTSDictionaryStmt(node: any, context: any): {
2701
+ AlterTSDictionaryStmt: any;
2702
+ } {
2703
+ const result: any = { ...node };
2704
+ return { AlterTSDictionaryStmt: result };
2705
+ }
2706
+ AlterTSConfigurationStmt(node: any, context: any): {
2707
+ AlterTSConfigurationStmt: any;
2708
+ } {
2709
+ const result: any = { ...node };
2710
+ return { AlterTSConfigurationStmt: result };
2711
+ }
2712
+ ClosePortalStmt(node: any, context: any): {
2713
+ ClosePortalStmt: any;
2714
+ } {
2715
+ const result: any = { ...node };
2716
+ return { ClosePortalStmt: result };
2717
+ }
2718
+ FetchStmt(node: any, context: any): {
2719
+ FetchStmt: any;
2720
+ } {
2721
+ const result: any = { ...node };
2722
+ return { FetchStmt: result };
2723
+ }
2724
+ AlterStatsStmt(node: any, context: any): {
2725
+ AlterStatsStmt: any;
2726
+ } {
2727
+ const result: any = { ...node };
2728
+ return { AlterStatsStmt: result };
2729
+ }
2730
+ ObjectWithArgs(node: any, context: any): {
2731
+ ObjectWithArgs: any;
2732
+ } {
2733
+ const result: any = { ...node };
2734
+ return { ObjectWithArgs: result };
2735
+ }
2736
+ AlterOperatorStmt(node: any, context: any): {
2737
+ AlterOperatorStmt: any;
2738
+ } {
2739
+ const result: any = { ...node };
2740
+ return { AlterOperatorStmt: result };
2741
+ }
2742
+ AlterFdwStmt(node: any, context: any): {
2743
+ AlterFdwStmt: any;
2744
+ } {
2745
+ const result: any = { ...node };
2746
+ return { AlterFdwStmt: result };
2747
+ }
2748
+ CreateForeignServerStmt(node: any, context: any): {
2749
+ CreateForeignServerStmt: any;
2750
+ } {
2751
+ const result: any = { ...node };
2752
+ return { CreateForeignServerStmt: result };
2753
+ }
2754
+ AlterForeignServerStmt(node: any, context: any): {
2755
+ AlterForeignServerStmt: any;
2756
+ } {
2757
+ const result: any = { ...node };
2758
+ return { AlterForeignServerStmt: result };
2759
+ }
2760
+ AlterUserMappingStmt(node: any, context: any): {
2761
+ AlterUserMappingStmt: any;
2762
+ } {
2763
+ const result: any = { ...node };
2764
+ return { AlterUserMappingStmt: result };
2765
+ }
2766
+ DropUserMappingStmt(node: any, context: any): {
2767
+ DropUserMappingStmt: any;
2768
+ } {
2769
+ const result: any = { ...node };
2770
+ return { DropUserMappingStmt: result };
2771
+ }
2772
+ ImportForeignSchemaStmt(node: any, context: any): {
2773
+ ImportForeignSchemaStmt: any;
2774
+ } {
2775
+ const result: any = { ...node };
2776
+ return { ImportForeignSchemaStmt: result };
2777
+ }
2778
+ ClusterStmt(node: any, context: any): {
2779
+ ClusterStmt: any;
2780
+ } {
2781
+ const result: any = { ...node };
2782
+ return { ClusterStmt: result };
2783
+ }
2784
+ VacuumStmt(node: any, context: any): {
2785
+ VacuumStmt: any;
2786
+ } {
2787
+ const result: any = { ...node };
2788
+ return { VacuumStmt: result };
2789
+ }
2790
+ ExplainStmt(node: any, context: any): {
2791
+ ExplainStmt: any;
2792
+ } {
2793
+ const result: any = { ...node };
2794
+ return { ExplainStmt: result };
2795
+ }
2796
+ ReindexStmt(node: any, context: any): {
2797
+ ReindexStmt: any;
2798
+ } {
2799
+ const result: any = { ...node };
2800
+ return { ReindexStmt: result };
2801
+ }
2802
+ CallStmt(node: any, context: any): {
2803
+ CallStmt: any;
2804
+ } {
2805
+ const result: any = { ...node };
2806
+ return { CallStmt: result };
2807
+ }
2808
+ CreatedbStmt(node: any, context: any): {
2809
+ CreatedbStmt: any;
2810
+ } {
2811
+ const result: any = { ...node };
2812
+ return { CreatedbStmt: result };
2813
+ }
2814
+ DropdbStmt(node: any, context: any): {
2815
+ DropdbStmt: any;
2816
+ } {
2817
+ const result: any = { ...node };
2818
+ return { DropdbStmt: result };
2819
+ }
2820
+ RenameStmt(node: any, context: any): {
2821
+ RenameStmt: any;
2822
+ } {
2823
+ const result: any = { ...node };
2824
+ return { RenameStmt: result };
2825
+ }
2826
+ AlterOwnerStmt(node: any, context: any): {
2827
+ AlterOwnerStmt: any;
2828
+ } {
2829
+ const result: any = { ...node };
2830
+ return { AlterOwnerStmt: result };
2831
+ }
2832
+ GrantRoleStmt(node: any, context: any): {
2833
+ GrantRoleStmt: any;
2834
+ } {
2835
+ const result: any = {};
2836
+ if (node.granted_roles !== undefined) {
2837
+ result.granted_roles = Array.isArray(node.granted_roles)
2838
+ ? node.granted_roles.map((item: any) => this.transform(item as any, context))
2839
+ : this.transform(node.granted_roles as any, context);
2840
+ }
2841
+ if (node.grantee_roles !== undefined) {
2842
+ result.grantee_roles = Array.isArray(node.grantee_roles)
2843
+ ? node.grantee_roles.map((item: any) => this.transform(item as any, context))
2844
+ : this.transform(node.grantee_roles as any, context);
2845
+ }
2846
+ if (node.is_grant !== undefined) {
2847
+ result.is_grant = node.is_grant;
2848
+ }
2849
+ if (node.behavior !== undefined) {
2850
+ result.behavior = node.behavior;
2851
+ }
2852
+ const nodeAny = node as any;
2853
+ if (nodeAny.admin_opt === true) {
2854
+ result.opt = [
2855
+ {
2856
+ DefElem: {
2857
+ defname: "admin",
2858
+ arg: {
2859
+ Boolean: {
2860
+ boolval: true
2861
+ }
2862
+ },
2863
+ defaction: "DEFELEM_UNSPEC"
2864
+ }
2865
+ }
2866
+ ];
2867
+ }
2868
+ else if (nodeAny.opt !== undefined) {
2869
+ // Handle any existing opt field by transforming it
2870
+ result.opt = Array.isArray(nodeAny.opt)
2871
+ ? nodeAny.opt.map((item: any) => this.transform(item as any, context))
2872
+ : this.transform(nodeAny.opt as any, context);
2873
+ }
2874
+ return { GrantRoleStmt: result };
2875
+ }
2876
+ SecLabelStmt(node: any, context: any): {
2877
+ SecLabelStmt: any;
2878
+ } {
2879
+ const result: any = { ...node };
2880
+ return { SecLabelStmt: result };
2881
+ }
2882
+ AlterDefaultPrivilegesStmt(node: any, context: any): {
2883
+ AlterDefaultPrivilegesStmt: any;
2884
+ } {
2885
+ const result: any = { ...node };
2886
+ return { AlterDefaultPrivilegesStmt: result };
2887
+ }
2888
+ CreateConversionStmt(node: any, context: any): {
2889
+ CreateConversionStmt: any;
2890
+ } {
2891
+ const result: any = { ...node };
2892
+ return { CreateConversionStmt: result };
2893
+ }
2894
+ CreateCastStmt(node: any, context: any): {
2895
+ CreateCastStmt: any;
2896
+ } {
2897
+ const result: any = { ...node };
2898
+ return { CreateCastStmt: result };
2899
+ }
2900
+ CreatePLangStmt(node: any, context: any): {
2901
+ CreatePLangStmt: any;
2902
+ } {
2903
+ const result: any = { ...node };
2904
+ return { CreatePLangStmt: result };
2905
+ }
2906
+ CreateTransformStmt(node: any, context: any): {
2907
+ CreateTransformStmt: any;
2908
+ } {
2909
+ const result: any = { ...node };
2910
+ return { CreateTransformStmt: result };
2911
+ }
2912
+ CreateTrigStmt(node: any, context: any): {
2913
+ CreateTrigStmt: any;
2914
+ } {
2915
+ const result: any = { ...node };
2916
+ return { CreateTrigStmt: result };
2917
+ }
2918
+ TriggerTransition(node: any, context: any): {
2919
+ TriggerTransition: any;
2920
+ } {
2921
+ const result: any = { ...node };
2922
+ return { TriggerTransition: result };
2923
+ }
2924
+ CreateEventTrigStmt(node: any, context: any): {
2925
+ CreateEventTrigStmt: any;
2926
+ } {
2927
+ const result: any = { ...node };
2928
+ return { CreateEventTrigStmt: result };
2929
+ }
2930
+ AlterEventTrigStmt(node: any, context: any): {
2931
+ AlterEventTrigStmt: any;
2932
+ } {
2933
+ const result: any = { ...node };
2934
+ return { AlterEventTrigStmt: result };
2935
+ }
2936
+ CreateOpClassStmt(node: any, context: any): {
2937
+ CreateOpClassStmt: any;
2938
+ } {
2939
+ const result: any = { ...node };
2940
+ return { CreateOpClassStmt: result };
2941
+ }
2942
+ CreateOpFamilyStmt(node: any, context: any): {
2943
+ CreateOpFamilyStmt: any;
2944
+ } {
2945
+ const result: any = { ...node };
2946
+ return { CreateOpFamilyStmt: result };
2947
+ }
2948
+ AlterOpFamilyStmt(node: any, context: any): {
2949
+ AlterOpFamilyStmt: any;
2950
+ } {
2951
+ const result: any = { ...node };
2952
+ return { AlterOpFamilyStmt: result };
2953
+ }
2954
+ MergeStmt(node: any, context: any): {
2955
+ MergeStmt: any;
2956
+ } {
2957
+ const result: any = { ...node };
2958
+ return { MergeStmt: result };
2959
+ }
2960
+ AlterTableMoveAllStmt(node: any, context: any): {
2961
+ AlterTableMoveAllStmt: any;
2962
+ } {
2963
+ const result: any = { ...node };
2964
+ return { AlterTableMoveAllStmt: result };
2965
+ }
2966
+ CreateSeqStmt(node: any, context: any): {
2967
+ CreateSeqStmt: any;
2968
+ } {
2969
+ const result: any = { ...node };
2970
+ return { CreateSeqStmt: result };
2971
+ }
2972
+ AlterSeqStmt(node: any, context: any): {
2973
+ AlterSeqStmt: any;
2974
+ } {
2975
+ const result: any = { ...node };
2976
+ return { AlterSeqStmt: result };
2977
+ }
2978
+ CreateRangeStmt(node: any, context: any): {
2979
+ CreateRangeStmt: any;
2980
+ } {
2981
+ const result: any = {};
2982
+ if (node.typeName !== undefined) {
2983
+ result.typeName = Array.isArray(node.typeName)
2984
+ ? node.typeName.map((item: any) => this.transform(item as any, context))
2985
+ : this.transform(node.typeName as any, context);
2986
+ }
2987
+ if (node.params !== undefined) {
2988
+ result.params = Array.isArray(node.params)
2989
+ ? node.params.map((item: any) => this.transform(item as any, context))
2990
+ : this.transform(node.params as any, context);
2991
+ }
2992
+ return { CreateRangeStmt: result };
2993
+ }
2994
+ AlterEnumStmt(node: any, context: any): {
2995
+ AlterEnumStmt: any;
2996
+ } {
2997
+ const result: any = { ...node };
2998
+ return { AlterEnumStmt: result };
2999
+ }
3000
+ AlterTypeStmt(node: any, context: any): {
3001
+ AlterTypeStmt: any;
3002
+ } {
3003
+ const result: any = { ...node };
3004
+ return { AlterTypeStmt: result };
3005
+ }
3006
+ AlterRoleStmt(node: any, context: any): {
3007
+ AlterRoleStmt: any;
3008
+ } {
3009
+ const result: any = { ...node };
3010
+ return { AlterRoleStmt: result };
3011
+ }
3012
+ CreateTableAsStmt(node: any, context: any): {
3013
+ CreateTableAsStmt: any;
3014
+ } {
3015
+ const result: any = { ...node };
3016
+ return { CreateTableAsStmt: result };
3017
+ }
3018
+ RefreshMatViewStmt(node: any, context: any): {
3019
+ RefreshMatViewStmt: any;
3020
+ } {
3021
+ const result: any = { ...node };
3022
+ return { RefreshMatViewStmt: result };
3023
+ }
3024
+ AccessPriv(node: any, context: any): {
3025
+ AccessPriv: any;
3026
+ } {
3027
+ const result: any = { ...node };
3028
+ return { AccessPriv: result };
3029
+ }
3030
+ AlterDatabaseStmt(node: any, context: any): {
3031
+ AlterDatabaseStmt: any;
3032
+ } {
3033
+ const result: any = { ...node };
3034
+ return { AlterDatabaseStmt: result };
3035
+ }
3036
+ AlterDatabaseRefreshCollStmt(node: any, context: any): {
3037
+ AlterDatabaseRefreshCollStmt: any;
3038
+ } {
3039
+ const result: any = { ...node };
3040
+ return { AlterDatabaseRefreshCollStmt: result };
3041
+ }
3042
+ AlterDatabaseSetStmt(node: any, context: any): {
3043
+ AlterDatabaseSetStmt: any;
3044
+ } {
3045
+ const result: any = { ...node };
3046
+ return { AlterDatabaseSetStmt: result };
3047
+ }
3048
+ DeclareCursorStmt(node: any, context: any): {
3049
+ DeclareCursorStmt: any;
3050
+ } {
3051
+ const result: any = { ...node };
3052
+ return { DeclareCursorStmt: result };
3053
+ }
3054
+ PublicationObjSpec(node: any, context: any): {
3055
+ PublicationObjSpec: any;
3056
+ } {
3057
+ const result: any = { ...node };
3058
+ return { PublicationObjSpec: result };
3059
+ }
3060
+ PublicationTable(node: any, context: any): {
3061
+ PublicationTable: any;
3062
+ } {
3063
+ const result: any = { ...node };
3064
+ return { PublicationTable: result };
3065
+ }
3066
+ CreateAmStmt(node: any, context: any): {
3067
+ CreateAmStmt: any;
3068
+ } {
3069
+ const result: any = { ...node };
3070
+ return { CreateAmStmt: result };
3071
+ }
3072
+ IntoClause(node: any, context: any): {
3073
+ IntoClause: any;
3074
+ } {
3075
+ const result: any = { ...node };
3076
+ return { IntoClause: result };
3077
+ }
3078
+ OnConflictExpr(node: any, context: any): {
3079
+ OnConflictExpr: any;
3080
+ } {
3081
+ const result: any = { ...node };
3082
+ return { OnConflictExpr: result };
3083
+ }
3084
+ ScanToken(node: any, context: any): {
3085
+ ScanToken: any;
3086
+ } {
3087
+ const result: any = { ...node };
3088
+ return { ScanToken: result };
3089
+ }
3090
+ CreateOpClassItem(node: any, context: any): {
3091
+ CreateOpClassItem: any;
3092
+ } {
3093
+ const result: any = { ...node };
3094
+ return { CreateOpClassItem: result };
3095
+ }
3096
+ Var(node: any, context: any): {
3097
+ Var: any;
3098
+ } {
3099
+ const result: any = { ...node };
3100
+ return { Var: result };
3101
+ }
3102
+ TableFunc(node: any, context: any): {
3103
+ TableFunc: any;
3104
+ } {
3105
+ const result: any = { ...node };
3106
+ return { TableFunc: result };
3107
+ }
3108
+ RangeTableFunc(node: any, context: any): {
3109
+ RangeTableFunc: any;
3110
+ } {
3111
+ const result: any = { ...node };
3112
+ return { RangeTableFunc: result };
3113
+ }
3114
+ RangeTableFuncCol(node: any, context: any): {
3115
+ RangeTableFuncCol: any;
3116
+ } {
3117
+ const result: any = { ...node };
3118
+ return { RangeTableFuncCol: result };
3119
+ }
3120
+ RangeFunction(node: any, context: any): {
3121
+ RangeFunction: any;
3122
+ } {
3123
+ const result: any = { ...node };
3124
+ if (node.lateral !== undefined) {
3125
+ result.lateral = node.lateral;
3126
+ }
3127
+ if (node.ordinality !== undefined) {
3128
+ result.ordinality = node.ordinality;
3129
+ }
3130
+ if (node.is_rowsfrom !== undefined) {
3131
+ result.is_rowsfrom = node.is_rowsfrom;
3132
+ }
3133
+ if (node.functions !== undefined) {
3134
+ result.functions = Array.isArray(node.functions)
3135
+ ? node.functions.map((item: any) => this.transform(item as any, context))
3136
+ : this.transform(node.functions as any, context);
3137
+ }
3138
+ if (node.alias !== undefined) {
3139
+ result.alias = this.transform(node.alias as any, context);
3140
+ }
3141
+ if (node.coldeflist !== undefined) {
3142
+ result.coldeflist = Array.isArray(node.coldeflist)
3143
+ ? node.coldeflist.map((item: any) => this.transform(item as any, context))
3144
+ : this.transform(node.coldeflist as any, context);
3145
+ }
3146
+ return { RangeFunction: result };
3147
+ }
3148
+ RangeTableSample(node: any, context: any): {
3149
+ RangeTableSample: any;
3150
+ } {
3151
+ const result: any = { ...node };
3152
+ if (node.relation !== undefined) {
3153
+ result.relation = this.transform(node.relation as any, context);
3154
+ }
3155
+ if (node.method !== undefined) {
3156
+ result.method = Array.isArray(node.method)
3157
+ ? node.method.map((item: any) => this.transform(item as any, context))
3158
+ : this.transform(node.method as any, context);
3159
+ }
3160
+ if (node.args !== undefined) {
3161
+ result.args = Array.isArray(node.args)
3162
+ ? node.args.map((item: any) => this.transform(item as any, context))
3163
+ : this.transform(node.args as any, context);
3164
+ }
3165
+ if (node.repeatable !== undefined) {
3166
+ result.repeatable = this.transform(node.repeatable as any, context);
3167
+ }
3168
+ return { RangeTableSample: result };
3169
+ }
3170
+ XmlSerialize(node: any, context: any): {
3171
+ XmlSerialize: any;
3172
+ } {
3173
+ const result: any = { ...node };
3174
+ if (node.xmloption !== undefined) {
3175
+ result.xmloption = node.xmloption;
3176
+ }
3177
+ if (node.expr !== undefined) {
3178
+ result.expr = this.transform(node.expr as any, context);
3179
+ }
3180
+ if (node.typeName !== undefined) {
3181
+ result.typeName = this.transform(node.typeName as any, context);
3182
+ }
3183
+ if (node.location !== undefined) {
3184
+ result.location = node.location;
3185
+ }
3186
+ return { XmlSerialize: result };
3187
+ }
3188
+ RuleStmt(node: any, context: any): {
3189
+ RuleStmt: any;
3190
+ } {
3191
+ const result: any = { ...node };
3192
+ return { RuleStmt: result };
3193
+ }
3194
+ SQLValueFunction(node: any, context: any): {
3195
+ SQLValueFunction: any;
3196
+ } {
3197
+ const result: any = { ...node };
3198
+ return { SQLValueFunction: result };
3199
+ }
3200
+ GroupingFunc(node: any, context: any): {
3201
+ GroupingFunc: any;
3202
+ } {
3203
+ const result: any = { ...node };
3204
+ return { GroupingFunc: result };
3205
+ }
3206
+ MultiAssignRef(node: any, context: any): {
3207
+ MultiAssignRef: any;
3208
+ } {
3209
+ const result: any = { ...node };
3210
+ return { MultiAssignRef: result };
3211
+ }
3212
+ SetToDefault(node: any, context: any): {
3213
+ SetToDefault: any;
3214
+ } {
3215
+ const result: any = { ...node };
3216
+ return { SetToDefault: result };
3217
+ }
3218
+ CurrentOfExpr(node: any, context: any): {
3219
+ CurrentOfExpr: any;
3220
+ } {
3221
+ const result: any = { ...node };
3222
+ return { CurrentOfExpr: result };
3223
+ }
3224
+ TableLikeClause(node: any, context: any): {
3225
+ TableLikeClause: any;
3226
+ } {
3227
+ const result: any = { ...node };
3228
+ return { TableLikeClause: result };
3229
+ }
3230
+ AlterFunctionStmt(node: any, context: any): {
3231
+ AlterFunctionStmt: any;
3232
+ } {
3233
+ const result: any = { ...node };
3234
+ return { AlterFunctionStmt: result };
3235
+ }
3236
+ AlterObjectSchemaStmt(node: any, context: any): {
3237
+ AlterObjectSchemaStmt: any;
3238
+ } {
3239
+ const result: any = { ...node };
3240
+ return { AlterObjectSchemaStmt: result };
3241
+ }
3242
+ CreateForeignTableStmt(node: any, context: any): {
3243
+ CreateForeignTableStmt: any;
3244
+ } {
3245
+ const result: any = { ...node };
3246
+ return { CreateForeignTableStmt: result };
3247
+ }
3248
+ DropRoleStmt(node: any, context: any): {
3249
+ DropRoleStmt: any;
3250
+ } {
3251
+ const result: any = { ...node };
3252
+ if (node.missing_ok !== undefined) {
3253
+ result.missing_ok = node.missing_ok;
3254
+ }
3255
+ if (node.roles !== undefined) {
3256
+ result.roles = Array.isArray(node.roles)
3257
+ ? node.roles.map((item: any) => this.transform(item as any, context))
3258
+ : this.transform(node.roles as any, context);
3259
+ }
3260
+ return { DropRoleStmt: result };
3261
+ }
3262
+ XmlExpr(node: any, context: any): {
3263
+ XmlExpr: any;
3264
+ } {
3265
+ const result: any = { ...node };
3266
+ if (node.xpr !== undefined) {
3267
+ result.xpr = this.transform(node.xpr as any, context);
3268
+ }
3269
+ if (node.op !== undefined) {
3270
+ result.op = node.op;
3271
+ }
3272
+ if (node.name !== undefined) {
3273
+ result.name = node.name;
3274
+ }
3275
+ if (node.named_args !== undefined) {
3276
+ result.named_args = Array.isArray(node.named_args)
3277
+ ? node.named_args.map((item: any) => this.transform(item as any, context))
3278
+ : this.transform(node.named_args as any, context);
3279
+ }
3280
+ if (node.arg_names !== undefined) {
3281
+ result.arg_names = Array.isArray(node.arg_names)
3282
+ ? node.arg_names.map((item: any) => this.transform(item as any, context))
3283
+ : this.transform(node.arg_names as any, context);
3284
+ }
3285
+ if (node.args !== undefined) {
3286
+ result.args = Array.isArray(node.args)
3287
+ ? node.args.map((item: any) => this.transform(item as any, context))
3288
+ : this.transform(node.args as any, context);
3289
+ }
3290
+ if (node.xmloption !== undefined) {
3291
+ result.xmloption = node.xmloption;
3292
+ }
3293
+ if (node.type !== undefined) {
3294
+ result.type = node.type;
3295
+ }
3296
+ if (node.typmod !== undefined) {
3297
+ result.typmod = node.typmod;
3298
+ }
3299
+ if (node.location !== undefined) {
3300
+ result.location = node.location;
3301
+ }
3302
+ return { XmlExpr: result };
3303
+ }
3304
+ AlterRoleSetStmt(node: any, context: any): {
3305
+ AlterRoleSetStmt: any;
3306
+ } {
3307
+ const result: any = { ...node };
3308
+ if (node.role !== undefined) {
3309
+ result.role = this.transform(node.role as any, context);
3310
+ }
3311
+ if (node.database !== undefined) {
3312
+ result.database = node.database;
3313
+ }
3314
+ if (node.setstmt !== undefined) {
3315
+ result.setstmt = this.transform(node.setstmt as any, context);
3316
+ }
3317
+ return { AlterRoleSetStmt: result };
3318
+ }
3319
+ GrantStmt(node: any, context: any): {
3320
+ GrantStmt: any;
3321
+ } {
3322
+ const result: any = { ...node };
3323
+ if (node.is_grant !== undefined) {
3324
+ result.is_grant = node.is_grant;
3325
+ }
3326
+ if (node.targtype !== undefined) {
3327
+ result.targtype = node.targtype;
3328
+ }
3329
+ if (node.objtype !== undefined) {
3330
+ result.objtype = node.objtype;
3331
+ }
3332
+ if (node.objects !== undefined) {
3333
+ result.objects = Array.isArray(node.objects)
3334
+ ? node.objects.map((item: any) => this.transform(item as any, context))
3335
+ : this.transform(node.objects as any, context);
3336
+ }
3337
+ if (node.privileges !== undefined) {
3338
+ result.privileges = Array.isArray(node.privileges)
3339
+ ? node.privileges.map((item: any) => this.transform(item as any, context))
3340
+ : this.transform(node.privileges as any, context);
3341
+ }
3342
+ if (node.grantees !== undefined) {
3343
+ result.grantees = Array.isArray(node.grantees)
3344
+ ? node.grantees.map((item: any) => this.transform(item as any, context))
3345
+ : this.transform(node.grantees as any, context);
3346
+ }
3347
+ if (node.grant_option !== undefined) {
3348
+ result.grant_option = node.grant_option;
3349
+ }
3350
+ if (node.behavior !== undefined) {
3351
+ result.behavior = node.behavior;
3352
+ }
3353
+ return { GrantStmt: result };
3354
+ }
3355
+ }