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