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