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