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