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