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