pgsql-deparser 13.18.0 → 13.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +12 -10
- package/deparser/deparser.d.ts +308 -0
- package/deparser/deparser.js +10477 -0
- package/deparser/index.d.ts +9 -0
- package/deparser/index.js +17 -0
- package/deparser/utils/list-utils.d.ts +8 -0
- package/deparser/utils/list-utils.js +30 -0
- package/deparser/utils/quote-utils.d.ts +24 -0
- package/deparser/utils/quote-utils.js +89 -0
- package/deparser/utils/sql-formatter.d.ts +16 -0
- package/deparser/utils/sql-formatter.js +40 -0
- package/deparser/visitors/base.d.ts +68 -0
- package/deparser/visitors/base.js +122 -0
- package/{src/deparser/deparser.ts → esm/deparser/deparser.js} +751 -752
- package/{src/deparser/index.ts → esm/deparser/index.js} +3 -4
- package/{src/deparser/utils/list-utils.ts → esm/deparser/utils/list-utils.js} +2 -3
- package/{src/deparser/utils/quote-utils.ts → esm/deparser/utils/quote-utils.js} +6 -7
- package/{src/deparser/utils/sql-formatter.ts → esm/deparser/utils/sql-formatter.js} +10 -11
- package/{src/deparser/visitors/base.ts → esm/deparser/visitors/base.js} +34 -62
- package/esm/index.js +15 -0
- package/{src/v13-to-v14.ts → esm/v13-to-v14.js} +472 -609
- package/{src/v13-to-v17-direct.ts → esm/v13-to-v17-direct.js} +11 -12
- package/{src/v14-to-v15.ts → esm/v14-to-v15.js} +261 -662
- package/{src/v15-to-v16.ts → esm/v15-to-v16.js} +814 -1229
- package/esm/v16-to-v17.js +1488 -0
- package/index.d.ts +9 -0
- package/index.js +19 -0
- package/package.json +5 -5
- package/v13-to-v14.d.ts +253 -0
- package/v13-to-v14.js +2754 -0
- package/v13-to-v17-direct.d.ts +24 -0
- package/v13-to-v17-direct.js +82 -0
- package/v14-to-v15.d.ts +616 -0
- package/v14-to-v15.js +1227 -0
- package/v15-to-v16.d.ts +633 -0
- package/v15-to-v16.js +2944 -0
- package/v16-to-v17.d.ts +638 -0
- package/v16-to-v17.js +1492 -0
- package/src/index.ts +0 -27
- package/src/v16-to-v17.ts +0 -1897
- package/tsconfig.esm.json +0 -8
- package/tsconfig.json +0 -26
package/src/v16-to-v17.ts
DELETED
|
@@ -1,1897 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auto-generated file with types stripped for better tree-shaking
|
|
3
|
-
* DO NOT EDIT - Generated by strip-transformer-types.ts
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// @ts-nocheck
|
|
7
|
-
/**
|
|
8
|
-
* V16 to V17 AST Transformer
|
|
9
|
-
* Transforms PostgreSQL v16 AST nodes to v17 format
|
|
10
|
-
*/
|
|
11
|
-
export class V16ToV17Transformer {
|
|
12
|
-
transform(node: any, context: any = { parentNodeTypes: [] }): any {
|
|
13
|
-
if (node == null) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
if (typeof node === 'number' || node instanceof Number) {
|
|
17
|
-
return node;
|
|
18
|
-
}
|
|
19
|
-
if (typeof node === 'string') {
|
|
20
|
-
return node;
|
|
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 as Error).message}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
visit(node: any, context: any = { parentNodeTypes: [] }): any {
|
|
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 as keyof this;
|
|
38
|
-
if (typeof this[methodName] === 'function') {
|
|
39
|
-
const childContext: any = {
|
|
40
|
-
...context,
|
|
41
|
-
parentNodeTypes: [...context.parentNodeTypes, nodeType]
|
|
42
|
-
};
|
|
43
|
-
const result = (this[methodName] as any)(nodeData, childContext);
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
// If no specific method, return the node as-is
|
|
47
|
-
return node;
|
|
48
|
-
}
|
|
49
|
-
getNodeType(node: any): any {
|
|
50
|
-
return Object.keys(node)[0];
|
|
51
|
-
}
|
|
52
|
-
getNodeData(node: any): any {
|
|
53
|
-
const keys = Object.keys(node);
|
|
54
|
-
if (keys.length === 1 && typeof (node as any)[keys[0]] === 'object') {
|
|
55
|
-
return (node as any)[keys[0]];
|
|
56
|
-
}
|
|
57
|
-
return node;
|
|
58
|
-
}
|
|
59
|
-
ParseResult(node: any, context: any): any {
|
|
60
|
-
if (node && typeof node === 'object' && 'version' in node && 'stmts' in node) {
|
|
61
|
-
return {
|
|
62
|
-
version: 170004, // PG17 version
|
|
63
|
-
stmts: node.stmts.map((stmt: any) => {
|
|
64
|
-
if (stmt && typeof stmt === 'object' && 'stmt' in stmt) {
|
|
65
|
-
return {
|
|
66
|
-
...stmt,
|
|
67
|
-
stmt: this.transform(stmt.stmt, context)
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
return this.transform(stmt, context);
|
|
71
|
-
})
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return node as any;
|
|
75
|
-
}
|
|
76
|
-
RawStmt(node: any, context: any): {
|
|
77
|
-
RawStmt: any;
|
|
78
|
-
} {
|
|
79
|
-
const result: any = {};
|
|
80
|
-
if (node.stmt !== undefined) {
|
|
81
|
-
result.stmt = this.transform(node.stmt as any, context);
|
|
82
|
-
}
|
|
83
|
-
if (node.stmt_location !== undefined) {
|
|
84
|
-
result.stmt_location = node.stmt_location;
|
|
85
|
-
}
|
|
86
|
-
if (node.stmt_len !== undefined) {
|
|
87
|
-
result.stmt_len = node.stmt_len;
|
|
88
|
-
}
|
|
89
|
-
return { RawStmt: result };
|
|
90
|
-
}
|
|
91
|
-
SelectStmt(node: any, context: any): {
|
|
92
|
-
SelectStmt: any;
|
|
93
|
-
} {
|
|
94
|
-
const result: any = {};
|
|
95
|
-
if (node.distinctClause !== undefined) {
|
|
96
|
-
result.distinctClause = Array.isArray(node.distinctClause)
|
|
97
|
-
? node.distinctClause.map(item => this.transform(item as any, context))
|
|
98
|
-
: this.transform(node.distinctClause as any, context);
|
|
99
|
-
}
|
|
100
|
-
if (node.intoClause !== undefined) {
|
|
101
|
-
result.intoClause = this.transform(node.intoClause as any, context);
|
|
102
|
-
}
|
|
103
|
-
if (node.targetList !== undefined) {
|
|
104
|
-
result.targetList = Array.isArray(node.targetList)
|
|
105
|
-
? node.targetList.map(item => this.transform(item as any, context))
|
|
106
|
-
: this.transform(node.targetList as any, context);
|
|
107
|
-
}
|
|
108
|
-
if (node.fromClause !== undefined) {
|
|
109
|
-
result.fromClause = Array.isArray(node.fromClause)
|
|
110
|
-
? node.fromClause.map(item => this.transform(item as any, context))
|
|
111
|
-
: this.transform(node.fromClause as any, context);
|
|
112
|
-
}
|
|
113
|
-
if (node.whereClause !== undefined) {
|
|
114
|
-
result.whereClause = this.transform(node.whereClause as any, context);
|
|
115
|
-
}
|
|
116
|
-
if (node.groupClause !== undefined) {
|
|
117
|
-
result.groupClause = Array.isArray(node.groupClause)
|
|
118
|
-
? node.groupClause.map(item => this.transform(item as any, context))
|
|
119
|
-
: this.transform(node.groupClause as any, 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 as any, context);
|
|
126
|
-
}
|
|
127
|
-
if (node.windowClause !== undefined) {
|
|
128
|
-
result.windowClause = Array.isArray(node.windowClause)
|
|
129
|
-
? node.windowClause.map(item => this.transform(item as any, context))
|
|
130
|
-
: this.transform(node.windowClause as any, context);
|
|
131
|
-
}
|
|
132
|
-
if (node.valuesLists !== undefined) {
|
|
133
|
-
const valuesContext: any = {
|
|
134
|
-
...context,
|
|
135
|
-
inValuesClause: true
|
|
136
|
-
};
|
|
137
|
-
result.valuesLists = Array.isArray(node.valuesLists)
|
|
138
|
-
? node.valuesLists.map(item => Array.isArray(item)
|
|
139
|
-
? item.map(subItem => this.transform(subItem as any, valuesContext))
|
|
140
|
-
: this.transform(item as any, valuesContext))
|
|
141
|
-
: this.transform(node.valuesLists as any, valuesContext);
|
|
142
|
-
}
|
|
143
|
-
if (node.sortClause !== undefined) {
|
|
144
|
-
result.sortClause = Array.isArray(node.sortClause)
|
|
145
|
-
? node.sortClause.map(item => this.transform(item as any, context))
|
|
146
|
-
: this.transform(node.sortClause as any, context);
|
|
147
|
-
}
|
|
148
|
-
if (node.limitOffset !== undefined) {
|
|
149
|
-
result.limitOffset = this.transform(node.limitOffset as any, context);
|
|
150
|
-
}
|
|
151
|
-
if (node.limitCount !== undefined) {
|
|
152
|
-
result.limitCount = this.transform(node.limitCount as any, context);
|
|
153
|
-
}
|
|
154
|
-
if (node.limitOption !== undefined) {
|
|
155
|
-
result.limitOption = node.limitOption;
|
|
156
|
-
}
|
|
157
|
-
if (node.lockingClause !== undefined) {
|
|
158
|
-
result.lockingClause = Array.isArray(node.lockingClause)
|
|
159
|
-
? node.lockingClause.map(item => this.transform(item as any, context))
|
|
160
|
-
: this.transform(node.lockingClause as any, context);
|
|
161
|
-
}
|
|
162
|
-
if (node.withClause !== undefined) {
|
|
163
|
-
result.withClause = this.transform(node.withClause as any, context);
|
|
164
|
-
}
|
|
165
|
-
if (node.op !== undefined) {
|
|
166
|
-
result.op = node.op;
|
|
167
|
-
}
|
|
168
|
-
if (node.all !== undefined) {
|
|
169
|
-
result.all = node.all;
|
|
170
|
-
}
|
|
171
|
-
if (node.larg !== undefined) {
|
|
172
|
-
result.larg = this.transform(node.larg as any, context);
|
|
173
|
-
}
|
|
174
|
-
if (node.rarg !== undefined) {
|
|
175
|
-
result.rarg = this.transform(node.rarg as any, context);
|
|
176
|
-
}
|
|
177
|
-
return { SelectStmt: result };
|
|
178
|
-
}
|
|
179
|
-
A_Expr(node: any, context: any): {
|
|
180
|
-
A_Expr: any;
|
|
181
|
-
} {
|
|
182
|
-
const result: any = {};
|
|
183
|
-
if (node.kind !== undefined) {
|
|
184
|
-
result.kind = node.kind;
|
|
185
|
-
}
|
|
186
|
-
if (node.name !== undefined) {
|
|
187
|
-
result.name = Array.isArray(node.name)
|
|
188
|
-
? node.name.map(item => this.transform(item as any, context))
|
|
189
|
-
: this.transform(node.name as any, context);
|
|
190
|
-
}
|
|
191
|
-
if (node.lexpr !== undefined) {
|
|
192
|
-
result.lexpr = this.transform(node.lexpr as any, context);
|
|
193
|
-
}
|
|
194
|
-
if (node.rexpr !== undefined) {
|
|
195
|
-
result.rexpr = this.transform(node.rexpr as any, context);
|
|
196
|
-
}
|
|
197
|
-
if (node.location !== undefined) {
|
|
198
|
-
result.location = node.location;
|
|
199
|
-
}
|
|
200
|
-
return { A_Expr: result };
|
|
201
|
-
}
|
|
202
|
-
InsertStmt(node: any, context: any): {
|
|
203
|
-
InsertStmt: any;
|
|
204
|
-
} {
|
|
205
|
-
const result: any = {};
|
|
206
|
-
if (node.relation !== undefined) {
|
|
207
|
-
result.relation = this.transform(node.relation as any, context);
|
|
208
|
-
}
|
|
209
|
-
if (node.cols !== undefined) {
|
|
210
|
-
result.cols = Array.isArray(node.cols)
|
|
211
|
-
? node.cols.map(item => this.transform(item as any, context))
|
|
212
|
-
: this.transform(node.cols as any, context);
|
|
213
|
-
}
|
|
214
|
-
if (node.selectStmt !== undefined) {
|
|
215
|
-
result.selectStmt = this.transform(node.selectStmt as any, context);
|
|
216
|
-
}
|
|
217
|
-
if (node.onConflictClause !== undefined) {
|
|
218
|
-
result.onConflictClause = this.transform(node.onConflictClause as any, context);
|
|
219
|
-
}
|
|
220
|
-
if (node.returningList !== undefined) {
|
|
221
|
-
result.returningList = Array.isArray(node.returningList)
|
|
222
|
-
? node.returningList.map(item => this.transform(item as any, context))
|
|
223
|
-
: this.transform(node.returningList as any, context);
|
|
224
|
-
}
|
|
225
|
-
if (node.withClause !== undefined) {
|
|
226
|
-
result.withClause = this.transform(node.withClause as any, context);
|
|
227
|
-
}
|
|
228
|
-
if (node.override !== undefined) {
|
|
229
|
-
result.override = node.override;
|
|
230
|
-
}
|
|
231
|
-
return { InsertStmt: result };
|
|
232
|
-
}
|
|
233
|
-
UpdateStmt(node: any, context: any): {
|
|
234
|
-
UpdateStmt: any;
|
|
235
|
-
} {
|
|
236
|
-
const result: any = {};
|
|
237
|
-
if (node.relation !== undefined) {
|
|
238
|
-
result.relation = this.transform(node.relation as any, context);
|
|
239
|
-
}
|
|
240
|
-
if (node.targetList !== undefined) {
|
|
241
|
-
result.targetList = Array.isArray(node.targetList)
|
|
242
|
-
? node.targetList.map(item => this.transform(item as any, context))
|
|
243
|
-
: this.transform(node.targetList as any, context);
|
|
244
|
-
}
|
|
245
|
-
if (node.whereClause !== undefined) {
|
|
246
|
-
result.whereClause = this.transform(node.whereClause as any, context);
|
|
247
|
-
}
|
|
248
|
-
if (node.fromClause !== undefined) {
|
|
249
|
-
result.fromClause = Array.isArray(node.fromClause)
|
|
250
|
-
? node.fromClause.map(item => this.transform(item as any, context))
|
|
251
|
-
: this.transform(node.fromClause as any, context);
|
|
252
|
-
}
|
|
253
|
-
if (node.returningList !== undefined) {
|
|
254
|
-
result.returningList = Array.isArray(node.returningList)
|
|
255
|
-
? node.returningList.map(item => this.transform(item as any, context))
|
|
256
|
-
: this.transform(node.returningList as any, context);
|
|
257
|
-
}
|
|
258
|
-
if (node.withClause !== undefined) {
|
|
259
|
-
result.withClause = this.transform(node.withClause as any, context);
|
|
260
|
-
}
|
|
261
|
-
return { UpdateStmt: result };
|
|
262
|
-
}
|
|
263
|
-
DeleteStmt(node: any, context: any): {
|
|
264
|
-
DeleteStmt: any;
|
|
265
|
-
} {
|
|
266
|
-
const result: any = {};
|
|
267
|
-
if (node.relation !== undefined) {
|
|
268
|
-
result.relation = this.transform(node.relation as any, context);
|
|
269
|
-
}
|
|
270
|
-
if (node.usingClause !== undefined) {
|
|
271
|
-
result.usingClause = Array.isArray(node.usingClause)
|
|
272
|
-
? node.usingClause.map(item => this.transform(item as any, context))
|
|
273
|
-
: this.transform(node.usingClause as any, context);
|
|
274
|
-
}
|
|
275
|
-
if (node.whereClause !== undefined) {
|
|
276
|
-
result.whereClause = this.transform(node.whereClause as any, context);
|
|
277
|
-
}
|
|
278
|
-
if (node.returningList !== undefined) {
|
|
279
|
-
result.returningList = Array.isArray(node.returningList)
|
|
280
|
-
? node.returningList.map(item => this.transform(item as any, context))
|
|
281
|
-
: this.transform(node.returningList as any, context);
|
|
282
|
-
}
|
|
283
|
-
if (node.withClause !== undefined) {
|
|
284
|
-
result.withClause = this.transform(node.withClause as any, context);
|
|
285
|
-
}
|
|
286
|
-
return { DeleteStmt: result };
|
|
287
|
-
}
|
|
288
|
-
WithClause(node: any, context: any): {
|
|
289
|
-
WithClause: any;
|
|
290
|
-
} {
|
|
291
|
-
const result: any = {};
|
|
292
|
-
if (node.ctes !== undefined) {
|
|
293
|
-
const cteContext = { ...context, inCTE: true };
|
|
294
|
-
result.ctes = Array.isArray(node.ctes)
|
|
295
|
-
? node.ctes.map(item => this.transform(item as any, cteContext))
|
|
296
|
-
: this.transform(node.ctes as any, cteContext);
|
|
297
|
-
}
|
|
298
|
-
if (node.recursive !== undefined) {
|
|
299
|
-
result.recursive = node.recursive;
|
|
300
|
-
}
|
|
301
|
-
if (node.location !== undefined) {
|
|
302
|
-
result.location = node.location;
|
|
303
|
-
}
|
|
304
|
-
return { WithClause: result };
|
|
305
|
-
}
|
|
306
|
-
ResTarget(node: any, context: any): {
|
|
307
|
-
ResTarget: any;
|
|
308
|
-
} {
|
|
309
|
-
const result: any = {};
|
|
310
|
-
if (node.name !== undefined) {
|
|
311
|
-
result.name = node.name;
|
|
312
|
-
}
|
|
313
|
-
if (node.indirection !== undefined) {
|
|
314
|
-
result.indirection = Array.isArray(node.indirection)
|
|
315
|
-
? node.indirection.map(item => this.transform(item as any, context))
|
|
316
|
-
: this.transform(node.indirection as any, context);
|
|
317
|
-
}
|
|
318
|
-
if (node.val !== undefined) {
|
|
319
|
-
result.val = this.transform(node.val as any, context);
|
|
320
|
-
}
|
|
321
|
-
if (node.location !== undefined) {
|
|
322
|
-
result.location = node.location;
|
|
323
|
-
}
|
|
324
|
-
return { ResTarget: result };
|
|
325
|
-
}
|
|
326
|
-
BoolExpr(node: any, context: any): {
|
|
327
|
-
BoolExpr: any;
|
|
328
|
-
} {
|
|
329
|
-
const result: any = {};
|
|
330
|
-
if (node.boolop !== undefined) {
|
|
331
|
-
result.boolop = node.boolop;
|
|
332
|
-
}
|
|
333
|
-
if (node.args !== undefined) {
|
|
334
|
-
result.args = Array.isArray(node.args)
|
|
335
|
-
? node.args.map(item => this.transform(item as any, context))
|
|
336
|
-
: this.transform(node.args as any, context);
|
|
337
|
-
}
|
|
338
|
-
if (node.location !== undefined) {
|
|
339
|
-
result.location = node.location;
|
|
340
|
-
}
|
|
341
|
-
return { BoolExpr: result };
|
|
342
|
-
}
|
|
343
|
-
FuncCall(node: any, context: any): {
|
|
344
|
-
FuncCall: any;
|
|
345
|
-
} {
|
|
346
|
-
const result: any = {};
|
|
347
|
-
if (node.funcname !== undefined) {
|
|
348
|
-
result.funcname = Array.isArray(node.funcname)
|
|
349
|
-
? node.funcname.map(item => this.transform(item as any, context))
|
|
350
|
-
: this.transform(node.funcname as any, context);
|
|
351
|
-
}
|
|
352
|
-
if (node.args !== undefined) {
|
|
353
|
-
result.args = Array.isArray(node.args)
|
|
354
|
-
? node.args.map(item => this.transform(item as any, context))
|
|
355
|
-
: this.transform(node.args as any, context);
|
|
356
|
-
}
|
|
357
|
-
if (node.agg_order !== undefined) {
|
|
358
|
-
result.agg_order = Array.isArray(node.agg_order)
|
|
359
|
-
? node.agg_order.map(item => this.transform(item as any, context))
|
|
360
|
-
: this.transform(node.agg_order as any, context);
|
|
361
|
-
}
|
|
362
|
-
if (node.agg_filter !== undefined) {
|
|
363
|
-
result.agg_filter = this.transform(node.agg_filter as any, context);
|
|
364
|
-
}
|
|
365
|
-
if (node.agg_within_group !== undefined) {
|
|
366
|
-
result.agg_within_group = node.agg_within_group;
|
|
367
|
-
}
|
|
368
|
-
if (node.agg_star !== undefined) {
|
|
369
|
-
result.agg_star = node.agg_star;
|
|
370
|
-
}
|
|
371
|
-
if (node.agg_distinct !== undefined) {
|
|
372
|
-
result.agg_distinct = node.agg_distinct;
|
|
373
|
-
}
|
|
374
|
-
if (node.func_variadic !== undefined) {
|
|
375
|
-
result.func_variadic = node.func_variadic;
|
|
376
|
-
}
|
|
377
|
-
if (node.over !== undefined) {
|
|
378
|
-
result.over = this.transform(node.over as any, context);
|
|
379
|
-
}
|
|
380
|
-
if (node.location !== undefined) {
|
|
381
|
-
result.location = node.location;
|
|
382
|
-
}
|
|
383
|
-
const funcformatValue = this.getFuncformatValue(node, result.funcname, context);
|
|
384
|
-
result.funcformat = funcformatValue;
|
|
385
|
-
return { FuncCall: result };
|
|
386
|
-
}
|
|
387
|
-
FuncExpr(node: any, context: any): {
|
|
388
|
-
FuncExpr: any;
|
|
389
|
-
} {
|
|
390
|
-
return { FuncExpr: node as any };
|
|
391
|
-
}
|
|
392
|
-
A_Const(node: any, context: any): {
|
|
393
|
-
A_Const: any;
|
|
394
|
-
} {
|
|
395
|
-
return { A_Const: node };
|
|
396
|
-
}
|
|
397
|
-
ColumnRef(node: any, context: any): {
|
|
398
|
-
ColumnRef: any;
|
|
399
|
-
} {
|
|
400
|
-
return { ColumnRef: node as any };
|
|
401
|
-
}
|
|
402
|
-
private isInCreateDomainContext(context: any): boolean {
|
|
403
|
-
return context.parentNodeTypes.includes('CreateDomainStmt');
|
|
404
|
-
}
|
|
405
|
-
private isInTypeCastContext(context: any): boolean {
|
|
406
|
-
return context.parentNodeTypes.includes('TypeCast');
|
|
407
|
-
}
|
|
408
|
-
private isInCreateTableContext(context: any): boolean {
|
|
409
|
-
return context.parentNodeTypes.includes('ColumnDef');
|
|
410
|
-
}
|
|
411
|
-
private isInValuesContext(context: any): boolean {
|
|
412
|
-
return context.inValuesClause === true;
|
|
413
|
-
}
|
|
414
|
-
private isInSimpleSelectTypeCastContext(context: any): boolean {
|
|
415
|
-
return context.parentNodeTypes.includes('TypeCast') &&
|
|
416
|
-
context.parentNodeTypes.includes('ResTarget') &&
|
|
417
|
-
!this.isInValuesContext(context);
|
|
418
|
-
}
|
|
419
|
-
private shouldAddPgCatalogPrefix(context: any): boolean {
|
|
420
|
-
const hasSelectStmt = context.parentNodeTypes.includes('SelectStmt');
|
|
421
|
-
const hasWithClause = context.parentNodeTypes.includes('WithClause');
|
|
422
|
-
const hasCommonTableExpr = context.parentNodeTypes.includes('CommonTableExpr');
|
|
423
|
-
return hasSelectStmt && !hasWithClause && !hasCommonTableExpr;
|
|
424
|
-
}
|
|
425
|
-
TypeName(node: any, context: any): {
|
|
426
|
-
TypeName: any;
|
|
427
|
-
} {
|
|
428
|
-
const result: any = {};
|
|
429
|
-
if (node.names !== undefined) {
|
|
430
|
-
let names = Array.isArray(node.names)
|
|
431
|
-
? node.names.map(item => this.transform(item as any, context))
|
|
432
|
-
: this.transform(node.names as any, context);
|
|
433
|
-
// Add pg_catalog prefix for JSON types in CREATE TABLE contexts
|
|
434
|
-
if (Array.isArray(names) && names.length === 1) {
|
|
435
|
-
const firstElement = names[0];
|
|
436
|
-
if (firstElement && typeof firstElement === 'object' && 'String' in firstElement) {
|
|
437
|
-
const typeNameStr = firstElement.String.str || firstElement.String.sval;
|
|
438
|
-
if (typeNameStr === 'json') {
|
|
439
|
-
const hasCreateStmt = context.parentNodeTypes.includes('CreateStmt');
|
|
440
|
-
const hasCompositeTypeStmt = context.parentNodeTypes.includes('CompositeTypeStmt');
|
|
441
|
-
const hasRangeFunction = context.parentNodeTypes.includes('RangeFunction');
|
|
442
|
-
const hasCreateDomainStmt = context.parentNodeTypes.includes('CreateDomainStmt');
|
|
443
|
-
const hasColumnDef = context.parentNodeTypes.includes('ColumnDef');
|
|
444
|
-
if ((hasCreateStmt || hasCompositeTypeStmt || hasRangeFunction) && hasColumnDef) {
|
|
445
|
-
const pgCatalogElement = {
|
|
446
|
-
String: {
|
|
447
|
-
sval: 'pg_catalog'
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
names = [pgCatalogElement, firstElement];
|
|
451
|
-
}
|
|
452
|
-
else if (hasCreateDomainStmt) {
|
|
453
|
-
const pgCatalogElement = {
|
|
454
|
-
String: {
|
|
455
|
-
sval: 'pg_catalog'
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
names = [pgCatalogElement, firstElement];
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
result.names = names;
|
|
464
|
-
}
|
|
465
|
-
if (node.typeOid !== undefined) {
|
|
466
|
-
result.typeOid = node.typeOid;
|
|
467
|
-
}
|
|
468
|
-
if (node.setof !== undefined) {
|
|
469
|
-
result.setof = node.setof;
|
|
470
|
-
}
|
|
471
|
-
if (node.pct_type !== undefined) {
|
|
472
|
-
result.pct_type = node.pct_type;
|
|
473
|
-
}
|
|
474
|
-
if (node.typmods !== undefined) {
|
|
475
|
-
result.typmods = Array.isArray(node.typmods)
|
|
476
|
-
? node.typmods.map(item => this.transform(item as any, context))
|
|
477
|
-
: this.transform(node.typmods as any, context);
|
|
478
|
-
}
|
|
479
|
-
if (node.typemod !== undefined) {
|
|
480
|
-
result.typemod = node.typemod;
|
|
481
|
-
}
|
|
482
|
-
if (node.arrayBounds !== undefined) {
|
|
483
|
-
result.arrayBounds = Array.isArray(node.arrayBounds)
|
|
484
|
-
? node.arrayBounds.map(item => this.transform(item as any, context))
|
|
485
|
-
: this.transform(node.arrayBounds as any, context);
|
|
486
|
-
}
|
|
487
|
-
if (node.location !== undefined) {
|
|
488
|
-
result.location = node.location;
|
|
489
|
-
}
|
|
490
|
-
return { TypeName: result };
|
|
491
|
-
}
|
|
492
|
-
Alias(node: any, context: any): {
|
|
493
|
-
Alias: any;
|
|
494
|
-
} {
|
|
495
|
-
return { Alias: node as any };
|
|
496
|
-
}
|
|
497
|
-
RangeVar(node: any, context: any): {
|
|
498
|
-
RangeVar: any;
|
|
499
|
-
} {
|
|
500
|
-
const result: any = {};
|
|
501
|
-
if (node.catalogname !== undefined) {
|
|
502
|
-
result.catalogname = node.catalogname;
|
|
503
|
-
}
|
|
504
|
-
if (node.schemaname !== undefined) {
|
|
505
|
-
result.schemaname = node.schemaname;
|
|
506
|
-
}
|
|
507
|
-
if (node.relname !== undefined) {
|
|
508
|
-
result.relname = node.relname;
|
|
509
|
-
}
|
|
510
|
-
if (node.inh !== undefined) {
|
|
511
|
-
result.inh = node.inh;
|
|
512
|
-
}
|
|
513
|
-
if (node.relpersistence !== undefined) {
|
|
514
|
-
result.relpersistence = node.relpersistence;
|
|
515
|
-
}
|
|
516
|
-
if (node.alias !== undefined) {
|
|
517
|
-
result.alias = this.transform(node.alias as any, context);
|
|
518
|
-
}
|
|
519
|
-
if (node.location !== undefined) {
|
|
520
|
-
result.location = node.location;
|
|
521
|
-
}
|
|
522
|
-
return { RangeVar: result };
|
|
523
|
-
}
|
|
524
|
-
A_ArrayExpr(node: any, context: any): {
|
|
525
|
-
A_ArrayExpr: any;
|
|
526
|
-
} {
|
|
527
|
-
return { A_ArrayExpr: node as any };
|
|
528
|
-
}
|
|
529
|
-
A_Indices(node: any, context: any): {
|
|
530
|
-
A_Indices: any;
|
|
531
|
-
} {
|
|
532
|
-
return { A_Indices: node as any };
|
|
533
|
-
}
|
|
534
|
-
A_Indirection(node: any, context: any): {
|
|
535
|
-
A_Indirection: any;
|
|
536
|
-
} {
|
|
537
|
-
return { A_Indirection: node as any };
|
|
538
|
-
}
|
|
539
|
-
A_Star(node: any, context: any): {
|
|
540
|
-
A_Star: any;
|
|
541
|
-
} {
|
|
542
|
-
return { A_Star: node as any };
|
|
543
|
-
}
|
|
544
|
-
CaseExpr(node: any, context: any): {
|
|
545
|
-
CaseExpr: any;
|
|
546
|
-
} {
|
|
547
|
-
return { CaseExpr: node as any };
|
|
548
|
-
}
|
|
549
|
-
CoalesceExpr(node: any, context: any): {
|
|
550
|
-
CoalesceExpr: any;
|
|
551
|
-
} {
|
|
552
|
-
return { CoalesceExpr: node as any };
|
|
553
|
-
}
|
|
554
|
-
TypeCast(node: any, context: any): {
|
|
555
|
-
TypeCast: any;
|
|
556
|
-
} {
|
|
557
|
-
const result: any = {};
|
|
558
|
-
if (node.arg !== undefined) {
|
|
559
|
-
result.arg = this.transform(node.arg as any, context);
|
|
560
|
-
}
|
|
561
|
-
if (node.typeName !== undefined) {
|
|
562
|
-
let typeName = this.transform(node.typeName as any, context);
|
|
563
|
-
// Add pg_catalog prefix for JSON types in simple SELECT contexts, but NOT in WITH clauses
|
|
564
|
-
if (typeName && typeName.names && Array.isArray(typeName.names) && typeName.names.length === 1) {
|
|
565
|
-
const firstElement = typeName.names[0];
|
|
566
|
-
if (firstElement && typeof firstElement === 'object' && 'String' in firstElement) {
|
|
567
|
-
const typeNameStr = firstElement.String.str || firstElement.String.sval;
|
|
568
|
-
if (typeNameStr === 'json') {
|
|
569
|
-
const hasSelectStmt = context.parentNodeTypes.includes('SelectStmt');
|
|
570
|
-
const hasResTarget = context.parentNodeTypes.includes('ResTarget');
|
|
571
|
-
const hasList = context.parentNodeTypes.includes('List');
|
|
572
|
-
const hasA_Expr = context.parentNodeTypes.includes('A_Expr');
|
|
573
|
-
const hasWithClause = context.parentNodeTypes.includes('WithClause');
|
|
574
|
-
const hasCommonTableExpr = context.parentNodeTypes.includes('CommonTableExpr');
|
|
575
|
-
if (((hasSelectStmt && hasResTarget) || (hasSelectStmt && hasList) || hasA_Expr) && !hasWithClause && !hasCommonTableExpr) {
|
|
576
|
-
const pgCatalogElement = {
|
|
577
|
-
String: {
|
|
578
|
-
sval: 'pg_catalog'
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
typeName.names = [pgCatalogElement, firstElement];
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
result.typeName = typeName;
|
|
587
|
-
}
|
|
588
|
-
if (node.location !== undefined) {
|
|
589
|
-
result.location = node.location;
|
|
590
|
-
}
|
|
591
|
-
return { TypeCast: result };
|
|
592
|
-
}
|
|
593
|
-
CollateClause(node: any, context: any): {
|
|
594
|
-
CollateClause: any;
|
|
595
|
-
} {
|
|
596
|
-
return { CollateClause: node as any };
|
|
597
|
-
}
|
|
598
|
-
BooleanTest(node: any, context: any): {
|
|
599
|
-
BooleanTest: any;
|
|
600
|
-
} {
|
|
601
|
-
return { BooleanTest: node as any };
|
|
602
|
-
}
|
|
603
|
-
NullTest(node: any, context: any): {
|
|
604
|
-
NullTest: any;
|
|
605
|
-
} {
|
|
606
|
-
return { NullTest: node as any };
|
|
607
|
-
}
|
|
608
|
-
String(node: any, context: any): {
|
|
609
|
-
String: any;
|
|
610
|
-
} {
|
|
611
|
-
return { String: node as any };
|
|
612
|
-
}
|
|
613
|
-
Integer(node: any, context: any): {
|
|
614
|
-
Integer: any;
|
|
615
|
-
} {
|
|
616
|
-
return { Integer: node as any };
|
|
617
|
-
}
|
|
618
|
-
Float(node: any, context: any): {
|
|
619
|
-
Float: any;
|
|
620
|
-
} {
|
|
621
|
-
return { Float: node as any };
|
|
622
|
-
}
|
|
623
|
-
Boolean(node: any, context: any): {
|
|
624
|
-
Boolean: any;
|
|
625
|
-
} {
|
|
626
|
-
return { Boolean: node as any };
|
|
627
|
-
}
|
|
628
|
-
BitString(node: any, context: any): {
|
|
629
|
-
BitString: any;
|
|
630
|
-
} {
|
|
631
|
-
return { BitString: node as any };
|
|
632
|
-
}
|
|
633
|
-
// NOTE: there is no Null type in PG17
|
|
634
|
-
Null(node: any, context: any): any {
|
|
635
|
-
return { Null: node };
|
|
636
|
-
}
|
|
637
|
-
List(node: any, context: any): {
|
|
638
|
-
List: any;
|
|
639
|
-
} {
|
|
640
|
-
const result: any = {};
|
|
641
|
-
if (node.items !== undefined) {
|
|
642
|
-
result.items = Array.isArray(node.items)
|
|
643
|
-
? node.items.map(item => this.transform(item as any, context))
|
|
644
|
-
: this.transform(node.items as any, context);
|
|
645
|
-
}
|
|
646
|
-
return { List: result };
|
|
647
|
-
}
|
|
648
|
-
CreateStmt(node: any, context: any): {
|
|
649
|
-
CreateStmt: any;
|
|
650
|
-
} {
|
|
651
|
-
const result: any = {};
|
|
652
|
-
if (node.relation !== undefined) {
|
|
653
|
-
result.relation = this.transform(node.relation as any, context);
|
|
654
|
-
}
|
|
655
|
-
if (node.tableElts !== undefined) {
|
|
656
|
-
result.tableElts = Array.isArray(node.tableElts)
|
|
657
|
-
? node.tableElts.map(item => this.transform(item as any, context))
|
|
658
|
-
: this.transform(node.tableElts as any, context);
|
|
659
|
-
}
|
|
660
|
-
if (node.inhRelations !== undefined) {
|
|
661
|
-
result.inhRelations = Array.isArray(node.inhRelations)
|
|
662
|
-
? node.inhRelations.map(item => this.transform(item as any, context))
|
|
663
|
-
: this.transform(node.inhRelations as any, context);
|
|
664
|
-
}
|
|
665
|
-
if (node.partbound !== undefined) {
|
|
666
|
-
result.partbound = this.transform(node.partbound as any, context);
|
|
667
|
-
}
|
|
668
|
-
if (node.partspec !== undefined) {
|
|
669
|
-
result.partspec = this.transform(node.partspec as any, context);
|
|
670
|
-
}
|
|
671
|
-
if (node.ofTypename !== undefined) {
|
|
672
|
-
result.ofTypename = this.transform(node.ofTypename as any, context);
|
|
673
|
-
}
|
|
674
|
-
if (node.constraints !== undefined) {
|
|
675
|
-
result.constraints = Array.isArray(node.constraints)
|
|
676
|
-
? node.constraints.map(item => this.transform(item as any, context))
|
|
677
|
-
: this.transform(node.constraints as any, context);
|
|
678
|
-
}
|
|
679
|
-
if (node.options !== undefined) {
|
|
680
|
-
result.options = Array.isArray(node.options)
|
|
681
|
-
? node.options.map(item => this.transform(item as any, context))
|
|
682
|
-
: this.transform(node.options as any, context);
|
|
683
|
-
}
|
|
684
|
-
if (node.oncommit !== undefined) {
|
|
685
|
-
result.oncommit = node.oncommit;
|
|
686
|
-
}
|
|
687
|
-
if (node.tablespacename !== undefined) {
|
|
688
|
-
result.tablespacename = node.tablespacename;
|
|
689
|
-
}
|
|
690
|
-
if (node.accessMethod !== undefined) {
|
|
691
|
-
result.accessMethod = node.accessMethod;
|
|
692
|
-
}
|
|
693
|
-
if (node.if_not_exists !== undefined) {
|
|
694
|
-
result.if_not_exists = node.if_not_exists;
|
|
695
|
-
}
|
|
696
|
-
return { CreateStmt: result };
|
|
697
|
-
}
|
|
698
|
-
ColumnDef(node: any, context: any): {
|
|
699
|
-
ColumnDef: any;
|
|
700
|
-
} {
|
|
701
|
-
const result: any = {};
|
|
702
|
-
if (node.colname !== undefined) {
|
|
703
|
-
result.colname = node.colname;
|
|
704
|
-
}
|
|
705
|
-
if (node.typeName !== undefined) {
|
|
706
|
-
const transformedTypeName = this.TypeName(node.typeName as any, context);
|
|
707
|
-
result.typeName = transformedTypeName.TypeName;
|
|
708
|
-
}
|
|
709
|
-
if (node.inhcount !== undefined) {
|
|
710
|
-
result.inhcount = node.inhcount;
|
|
711
|
-
}
|
|
712
|
-
if (node.is_local !== undefined) {
|
|
713
|
-
result.is_local = node.is_local;
|
|
714
|
-
}
|
|
715
|
-
if (node.is_not_null !== undefined) {
|
|
716
|
-
result.is_not_null = node.is_not_null;
|
|
717
|
-
}
|
|
718
|
-
if (node.is_from_type !== undefined) {
|
|
719
|
-
result.is_from_type = node.is_from_type;
|
|
720
|
-
}
|
|
721
|
-
if (node.storage !== undefined) {
|
|
722
|
-
result.storage = node.storage;
|
|
723
|
-
}
|
|
724
|
-
if (node.raw_default !== undefined) {
|
|
725
|
-
result.raw_default = this.transform(node.raw_default as any, context);
|
|
726
|
-
}
|
|
727
|
-
if (node.cooked_default !== undefined) {
|
|
728
|
-
result.cooked_default = this.transform(node.cooked_default as any, context);
|
|
729
|
-
}
|
|
730
|
-
if (node.identity !== undefined) {
|
|
731
|
-
result.identity = node.identity;
|
|
732
|
-
}
|
|
733
|
-
if (node.identitySequence !== undefined) {
|
|
734
|
-
result.identitySequence = this.transform(node.identitySequence as any, context);
|
|
735
|
-
}
|
|
736
|
-
if (node.generated !== undefined) {
|
|
737
|
-
result.generated = node.generated;
|
|
738
|
-
}
|
|
739
|
-
if (node.collClause !== undefined) {
|
|
740
|
-
result.collClause = this.transform(node.collClause as any, context);
|
|
741
|
-
}
|
|
742
|
-
if (node.collOid !== undefined) {
|
|
743
|
-
result.collOid = node.collOid;
|
|
744
|
-
}
|
|
745
|
-
if (node.constraints !== undefined) {
|
|
746
|
-
result.constraints = Array.isArray(node.constraints)
|
|
747
|
-
? node.constraints.map(item => this.transform(item as any, context))
|
|
748
|
-
: this.transform(node.constraints as any, context);
|
|
749
|
-
}
|
|
750
|
-
if (node.fdwoptions !== undefined) {
|
|
751
|
-
result.fdwoptions = Array.isArray(node.fdwoptions)
|
|
752
|
-
? node.fdwoptions.map(item => this.transform(item as any, context))
|
|
753
|
-
: this.transform(node.fdwoptions as any, context);
|
|
754
|
-
}
|
|
755
|
-
if (node.location !== undefined) {
|
|
756
|
-
result.location = node.location;
|
|
757
|
-
}
|
|
758
|
-
return { ColumnDef: result };
|
|
759
|
-
}
|
|
760
|
-
Constraint(node: any, context: any): {
|
|
761
|
-
Constraint: any;
|
|
762
|
-
} {
|
|
763
|
-
return { Constraint: node as any };
|
|
764
|
-
}
|
|
765
|
-
SubLink(node: any, context: any): {
|
|
766
|
-
SubLink: any;
|
|
767
|
-
} {
|
|
768
|
-
return { SubLink: node as any };
|
|
769
|
-
}
|
|
770
|
-
CaseWhen(node: any, context: any): {
|
|
771
|
-
CaseWhen: any;
|
|
772
|
-
} {
|
|
773
|
-
return { CaseWhen: node as any };
|
|
774
|
-
}
|
|
775
|
-
WindowDef(node: any, context: any): {
|
|
776
|
-
WindowDef: any;
|
|
777
|
-
} {
|
|
778
|
-
return { WindowDef: node as any };
|
|
779
|
-
}
|
|
780
|
-
SortBy(node: any, context: any): {
|
|
781
|
-
SortBy: any;
|
|
782
|
-
} {
|
|
783
|
-
return { SortBy: node as any };
|
|
784
|
-
}
|
|
785
|
-
GroupingSet(node: any, context: any): {
|
|
786
|
-
GroupingSet: any;
|
|
787
|
-
} {
|
|
788
|
-
return { GroupingSet: node as any };
|
|
789
|
-
}
|
|
790
|
-
CommonTableExpr(node: any, context: any): {
|
|
791
|
-
CommonTableExpr: any;
|
|
792
|
-
} {
|
|
793
|
-
const result: any = {};
|
|
794
|
-
if (node.ctename !== undefined) {
|
|
795
|
-
result.ctename = node.ctename;
|
|
796
|
-
}
|
|
797
|
-
if (node.aliascolnames !== undefined) {
|
|
798
|
-
result.aliascolnames = Array.isArray(node.aliascolnames)
|
|
799
|
-
? node.aliascolnames.map(item => this.transform(item as any, context))
|
|
800
|
-
: this.transform(node.aliascolnames as any, context);
|
|
801
|
-
}
|
|
802
|
-
if (node.ctematerialized !== undefined) {
|
|
803
|
-
result.ctematerialized = node.ctematerialized;
|
|
804
|
-
}
|
|
805
|
-
if (node.ctequery !== undefined) {
|
|
806
|
-
result.ctequery = this.transform(node.ctequery as any, context);
|
|
807
|
-
}
|
|
808
|
-
if (node.search_clause !== undefined) {
|
|
809
|
-
result.search_clause = this.transform(node.search_clause as any, context);
|
|
810
|
-
}
|
|
811
|
-
if (node.cycle_clause !== undefined) {
|
|
812
|
-
result.cycle_clause = this.transform(node.cycle_clause as any, context);
|
|
813
|
-
}
|
|
814
|
-
if (node.location !== undefined) {
|
|
815
|
-
result.location = node.location;
|
|
816
|
-
}
|
|
817
|
-
return { CommonTableExpr: result };
|
|
818
|
-
}
|
|
819
|
-
ParamRef(node: any, context: any): {
|
|
820
|
-
ParamRef: any;
|
|
821
|
-
} {
|
|
822
|
-
return { ParamRef: node as any };
|
|
823
|
-
}
|
|
824
|
-
LockingClause(node: any, context: any): {
|
|
825
|
-
LockingClause: any;
|
|
826
|
-
} {
|
|
827
|
-
return { LockingClause: node };
|
|
828
|
-
}
|
|
829
|
-
MinMaxExpr(node: any, context: any): {
|
|
830
|
-
MinMaxExpr: any;
|
|
831
|
-
} {
|
|
832
|
-
return { MinMaxExpr: node as any };
|
|
833
|
-
}
|
|
834
|
-
RowExpr(node: any, context: any): {
|
|
835
|
-
RowExpr: any;
|
|
836
|
-
} {
|
|
837
|
-
return { RowExpr: node as any };
|
|
838
|
-
}
|
|
839
|
-
OpExpr(node: any, context: any): {
|
|
840
|
-
OpExpr: any;
|
|
841
|
-
} {
|
|
842
|
-
return { OpExpr: node as any };
|
|
843
|
-
}
|
|
844
|
-
DistinctExpr(node: any, context: any): {
|
|
845
|
-
DistinctExpr: any;
|
|
846
|
-
} {
|
|
847
|
-
return { DistinctExpr: node as any };
|
|
848
|
-
}
|
|
849
|
-
NullIfExpr(node: any, context: any): {
|
|
850
|
-
NullIfExpr: any;
|
|
851
|
-
} {
|
|
852
|
-
return { NullIfExpr: node as any };
|
|
853
|
-
}
|
|
854
|
-
ScalarArrayOpExpr(node: any, context: any): {
|
|
855
|
-
ScalarArrayOpExpr: any;
|
|
856
|
-
} {
|
|
857
|
-
return { ScalarArrayOpExpr: node as any };
|
|
858
|
-
}
|
|
859
|
-
Aggref(node: any, context: any): {
|
|
860
|
-
Aggref: any;
|
|
861
|
-
} {
|
|
862
|
-
return { Aggref: node as any };
|
|
863
|
-
}
|
|
864
|
-
WindowFunc(node: any, context: any): {
|
|
865
|
-
WindowFunc: any;
|
|
866
|
-
} {
|
|
867
|
-
return { WindowFunc: node as any };
|
|
868
|
-
}
|
|
869
|
-
FieldSelect(node: any, context: any): {
|
|
870
|
-
FieldSelect: any;
|
|
871
|
-
} {
|
|
872
|
-
return { FieldSelect: node as any };
|
|
873
|
-
}
|
|
874
|
-
RelabelType(node: any, context: any): {
|
|
875
|
-
RelabelType: any;
|
|
876
|
-
} {
|
|
877
|
-
return { RelabelType: node as any };
|
|
878
|
-
}
|
|
879
|
-
CoerceViaIO(node: any, context: any): {
|
|
880
|
-
CoerceViaIO: any;
|
|
881
|
-
} {
|
|
882
|
-
return { CoerceViaIO: node as any };
|
|
883
|
-
}
|
|
884
|
-
ArrayCoerceExpr(node: any, context: any): {
|
|
885
|
-
ArrayCoerceExpr: any;
|
|
886
|
-
} {
|
|
887
|
-
return { ArrayCoerceExpr: node as any };
|
|
888
|
-
}
|
|
889
|
-
ConvertRowtypeExpr(node: any, context: any): {
|
|
890
|
-
ConvertRowtypeExpr: any;
|
|
891
|
-
} {
|
|
892
|
-
return { ConvertRowtypeExpr: node as any };
|
|
893
|
-
}
|
|
894
|
-
NamedArgExpr(node: any, context: any): {
|
|
895
|
-
NamedArgExpr: any;
|
|
896
|
-
} {
|
|
897
|
-
return { NamedArgExpr: node as any };
|
|
898
|
-
}
|
|
899
|
-
ViewStmt(node: any, context: any): {
|
|
900
|
-
ViewStmt: any;
|
|
901
|
-
} {
|
|
902
|
-
return { ViewStmt: node as any };
|
|
903
|
-
}
|
|
904
|
-
IndexStmt(node: any, context: any): {
|
|
905
|
-
IndexStmt: any;
|
|
906
|
-
} {
|
|
907
|
-
return { IndexStmt: node as any };
|
|
908
|
-
}
|
|
909
|
-
IndexElem(node: any, context: any): {
|
|
910
|
-
IndexElem: any;
|
|
911
|
-
} {
|
|
912
|
-
return { IndexElem: node as any };
|
|
913
|
-
}
|
|
914
|
-
PartitionElem(node: any, context: any): {
|
|
915
|
-
PartitionElem: any;
|
|
916
|
-
} {
|
|
917
|
-
return { PartitionElem: node as any };
|
|
918
|
-
}
|
|
919
|
-
PartitionCmd(node: any, context: any): {
|
|
920
|
-
PartitionCmd: any;
|
|
921
|
-
} {
|
|
922
|
-
return { PartitionCmd: node as any };
|
|
923
|
-
}
|
|
924
|
-
JoinExpr(node: any, context: any): {
|
|
925
|
-
JoinExpr: any;
|
|
926
|
-
} {
|
|
927
|
-
return { JoinExpr: node as any };
|
|
928
|
-
}
|
|
929
|
-
FromExpr(node: any, context: any): {
|
|
930
|
-
FromExpr: any;
|
|
931
|
-
} {
|
|
932
|
-
return { FromExpr: node as any };
|
|
933
|
-
}
|
|
934
|
-
TransactionStmt(node: any, context: any): {
|
|
935
|
-
TransactionStmt: any;
|
|
936
|
-
} {
|
|
937
|
-
return { TransactionStmt: node as any };
|
|
938
|
-
}
|
|
939
|
-
VariableSetStmt(node: any, context: any): {
|
|
940
|
-
VariableSetStmt: any;
|
|
941
|
-
} {
|
|
942
|
-
return { VariableSetStmt: node as any };
|
|
943
|
-
}
|
|
944
|
-
VariableShowStmt(node: any, context: any): {
|
|
945
|
-
VariableShowStmt: any;
|
|
946
|
-
} {
|
|
947
|
-
return { VariableShowStmt: node as any };
|
|
948
|
-
}
|
|
949
|
-
CreateSchemaStmt(node: any, context: any): {
|
|
950
|
-
CreateSchemaStmt: any;
|
|
951
|
-
} {
|
|
952
|
-
return { CreateSchemaStmt: node as any };
|
|
953
|
-
}
|
|
954
|
-
RoleSpec(node: any, context: any): {
|
|
955
|
-
RoleSpec: any;
|
|
956
|
-
} {
|
|
957
|
-
return { RoleSpec: node as any };
|
|
958
|
-
}
|
|
959
|
-
DropStmt(node: any, context: any): {
|
|
960
|
-
DropStmt: any;
|
|
961
|
-
} {
|
|
962
|
-
return { DropStmt: node as any };
|
|
963
|
-
}
|
|
964
|
-
TruncateStmt(node: any, context: any): {
|
|
965
|
-
TruncateStmt: any;
|
|
966
|
-
} {
|
|
967
|
-
return { TruncateStmt: node as any };
|
|
968
|
-
}
|
|
969
|
-
ReturnStmt(node: any, context: any): {
|
|
970
|
-
ReturnStmt: any;
|
|
971
|
-
} {
|
|
972
|
-
return { ReturnStmt: node as any };
|
|
973
|
-
}
|
|
974
|
-
PLAssignStmt(node: any, context: any): {
|
|
975
|
-
PLAssignStmt: any;
|
|
976
|
-
} {
|
|
977
|
-
return { PLAssignStmt: node as any };
|
|
978
|
-
}
|
|
979
|
-
CopyStmt(node: any, context: any): {
|
|
980
|
-
CopyStmt: any;
|
|
981
|
-
} {
|
|
982
|
-
return { CopyStmt: node as any };
|
|
983
|
-
}
|
|
984
|
-
AlterTableStmt(node: any, context: any): {
|
|
985
|
-
AlterTableStmt: any;
|
|
986
|
-
} {
|
|
987
|
-
return { AlterTableStmt: node as any };
|
|
988
|
-
}
|
|
989
|
-
AlterTableCmd(node: any, context: any): {
|
|
990
|
-
AlterTableCmd: any;
|
|
991
|
-
} {
|
|
992
|
-
return { AlterTableCmd: node as any };
|
|
993
|
-
}
|
|
994
|
-
CreateFunctionStmt(node: any, context: any): {
|
|
995
|
-
CreateFunctionStmt: any;
|
|
996
|
-
} {
|
|
997
|
-
return { CreateFunctionStmt: node as any };
|
|
998
|
-
}
|
|
999
|
-
FunctionParameter(node: any, context: any): {
|
|
1000
|
-
FunctionParameter: any;
|
|
1001
|
-
} {
|
|
1002
|
-
return { FunctionParameter: node as any };
|
|
1003
|
-
}
|
|
1004
|
-
CreateEnumStmt(node: any, context: any): {
|
|
1005
|
-
CreateEnumStmt: any;
|
|
1006
|
-
} {
|
|
1007
|
-
return { CreateEnumStmt: node as any };
|
|
1008
|
-
}
|
|
1009
|
-
CreateDomainStmt(node: any, context: any): {
|
|
1010
|
-
CreateDomainStmt: any;
|
|
1011
|
-
} {
|
|
1012
|
-
const result: any = {};
|
|
1013
|
-
if (node.domainname !== undefined) {
|
|
1014
|
-
result.domainname = Array.isArray(node.domainname)
|
|
1015
|
-
? node.domainname.map(item => this.transform(item as any, context))
|
|
1016
|
-
: this.transform(node.domainname as any, context);
|
|
1017
|
-
}
|
|
1018
|
-
if (node.typeName !== undefined) {
|
|
1019
|
-
const transformedTypeName = this.TypeName(node.typeName as any, context);
|
|
1020
|
-
result.typeName = transformedTypeName.TypeName;
|
|
1021
|
-
}
|
|
1022
|
-
if (node.collClause !== undefined) {
|
|
1023
|
-
result.collClause = this.transform(node.collClause as any, context);
|
|
1024
|
-
}
|
|
1025
|
-
if (node.constraints !== undefined) {
|
|
1026
|
-
result.constraints = Array.isArray(node.constraints)
|
|
1027
|
-
? node.constraints.map(item => this.transform(item as any, context))
|
|
1028
|
-
: this.transform(node.constraints as any, context);
|
|
1029
|
-
}
|
|
1030
|
-
return { CreateDomainStmt: result };
|
|
1031
|
-
}
|
|
1032
|
-
CreateRoleStmt(node: any, context: any): {
|
|
1033
|
-
CreateRoleStmt: any;
|
|
1034
|
-
} {
|
|
1035
|
-
return { CreateRoleStmt: node as any };
|
|
1036
|
-
}
|
|
1037
|
-
DefElem(node: any, context: any): {
|
|
1038
|
-
DefElem: any;
|
|
1039
|
-
} {
|
|
1040
|
-
return { DefElem: node as any };
|
|
1041
|
-
}
|
|
1042
|
-
CreateTableSpaceStmt(node: any, context: any): {
|
|
1043
|
-
CreateTableSpaceStmt: any;
|
|
1044
|
-
} {
|
|
1045
|
-
return { CreateTableSpaceStmt: node as any };
|
|
1046
|
-
}
|
|
1047
|
-
DropTableSpaceStmt(node: any, context: any): {
|
|
1048
|
-
DropTableSpaceStmt: any;
|
|
1049
|
-
} {
|
|
1050
|
-
return { DropTableSpaceStmt: node as any };
|
|
1051
|
-
}
|
|
1052
|
-
AlterTableSpaceOptionsStmt(node: any, context: any): {
|
|
1053
|
-
AlterTableSpaceOptionsStmt: any;
|
|
1054
|
-
} {
|
|
1055
|
-
return { AlterTableSpaceOptionsStmt: node as any };
|
|
1056
|
-
}
|
|
1057
|
-
CreateExtensionStmt(node: any, context: any): {
|
|
1058
|
-
CreateExtensionStmt: any;
|
|
1059
|
-
} {
|
|
1060
|
-
return { CreateExtensionStmt: node as any };
|
|
1061
|
-
}
|
|
1062
|
-
AlterExtensionStmt(node: any, context: any): {
|
|
1063
|
-
AlterExtensionStmt: any;
|
|
1064
|
-
} {
|
|
1065
|
-
return { AlterExtensionStmt: node as any };
|
|
1066
|
-
}
|
|
1067
|
-
CreateFdwStmt(node: any, context: any): {
|
|
1068
|
-
CreateFdwStmt: any;
|
|
1069
|
-
} {
|
|
1070
|
-
return { CreateFdwStmt: node as any };
|
|
1071
|
-
}
|
|
1072
|
-
SetOperationStmt(node: any, context: any): {
|
|
1073
|
-
SetOperationStmt: any;
|
|
1074
|
-
} {
|
|
1075
|
-
return { SetOperationStmt: node as any };
|
|
1076
|
-
}
|
|
1077
|
-
ReplicaIdentityStmt(node: any, context: any): {
|
|
1078
|
-
ReplicaIdentityStmt: any;
|
|
1079
|
-
} {
|
|
1080
|
-
return { ReplicaIdentityStmt: node as any };
|
|
1081
|
-
}
|
|
1082
|
-
AlterCollationStmt(node: any, context: any): {
|
|
1083
|
-
AlterCollationStmt: any;
|
|
1084
|
-
} {
|
|
1085
|
-
return { AlterCollationStmt: node as any };
|
|
1086
|
-
}
|
|
1087
|
-
AlterDomainStmt(node: any, context: any): {
|
|
1088
|
-
AlterDomainStmt: any;
|
|
1089
|
-
} {
|
|
1090
|
-
return { AlterDomainStmt: node as any };
|
|
1091
|
-
}
|
|
1092
|
-
PrepareStmt(node: any, context: any): {
|
|
1093
|
-
PrepareStmt: any;
|
|
1094
|
-
} {
|
|
1095
|
-
return { PrepareStmt: node as any };
|
|
1096
|
-
}
|
|
1097
|
-
ExecuteStmt(node: any, context: any): {
|
|
1098
|
-
ExecuteStmt: any;
|
|
1099
|
-
} {
|
|
1100
|
-
return { ExecuteStmt: node as any };
|
|
1101
|
-
}
|
|
1102
|
-
DeallocateStmt(node: any, context: any): {
|
|
1103
|
-
DeallocateStmt: any;
|
|
1104
|
-
} {
|
|
1105
|
-
const result: any = {};
|
|
1106
|
-
if (node.name !== undefined) {
|
|
1107
|
-
result.name = node.name;
|
|
1108
|
-
}
|
|
1109
|
-
if (node.name === undefined || node.name === null) {
|
|
1110
|
-
result.isall = true;
|
|
1111
|
-
}
|
|
1112
|
-
return { DeallocateStmt: result };
|
|
1113
|
-
}
|
|
1114
|
-
NotifyStmt(node: any, context: any): {
|
|
1115
|
-
NotifyStmt: any;
|
|
1116
|
-
} {
|
|
1117
|
-
return { NotifyStmt: node as any };
|
|
1118
|
-
}
|
|
1119
|
-
ListenStmt(node: any, context: any): {
|
|
1120
|
-
ListenStmt: any;
|
|
1121
|
-
} {
|
|
1122
|
-
return { ListenStmt: node as any };
|
|
1123
|
-
}
|
|
1124
|
-
UnlistenStmt(node: any, context: any): {
|
|
1125
|
-
UnlistenStmt: any;
|
|
1126
|
-
} {
|
|
1127
|
-
return { UnlistenStmt: node as any };
|
|
1128
|
-
}
|
|
1129
|
-
CheckPointStmt(node: any, context: any): {
|
|
1130
|
-
CheckPointStmt: any;
|
|
1131
|
-
} {
|
|
1132
|
-
return { CheckPointStmt: node as any };
|
|
1133
|
-
}
|
|
1134
|
-
LoadStmt(node: any, context: any): {
|
|
1135
|
-
LoadStmt: any;
|
|
1136
|
-
} {
|
|
1137
|
-
return { LoadStmt: node as any };
|
|
1138
|
-
}
|
|
1139
|
-
DiscardStmt(node: any, context: any): {
|
|
1140
|
-
DiscardStmt: any;
|
|
1141
|
-
} {
|
|
1142
|
-
return { DiscardStmt: node as any };
|
|
1143
|
-
}
|
|
1144
|
-
CommentStmt(node: any, context: any): {
|
|
1145
|
-
CommentStmt: any;
|
|
1146
|
-
} {
|
|
1147
|
-
return { CommentStmt: node as any };
|
|
1148
|
-
}
|
|
1149
|
-
LockStmt(node: any, context: any): {
|
|
1150
|
-
LockStmt: any;
|
|
1151
|
-
} {
|
|
1152
|
-
return { LockStmt: node as any };
|
|
1153
|
-
}
|
|
1154
|
-
CreatePolicyStmt(node: any, context: any): {
|
|
1155
|
-
CreatePolicyStmt: any;
|
|
1156
|
-
} {
|
|
1157
|
-
return { CreatePolicyStmt: node as any };
|
|
1158
|
-
}
|
|
1159
|
-
AlterPolicyStmt(node: any, context: any): {
|
|
1160
|
-
AlterPolicyStmt: any;
|
|
1161
|
-
} {
|
|
1162
|
-
return { AlterPolicyStmt: node as any };
|
|
1163
|
-
}
|
|
1164
|
-
CreateUserMappingStmt(node: any, context: any): {
|
|
1165
|
-
CreateUserMappingStmt: any;
|
|
1166
|
-
} {
|
|
1167
|
-
return { CreateUserMappingStmt: node as any };
|
|
1168
|
-
}
|
|
1169
|
-
CreateStatsStmt(node: any, context: any): {
|
|
1170
|
-
CreateStatsStmt: any;
|
|
1171
|
-
} {
|
|
1172
|
-
return { CreateStatsStmt: node as any };
|
|
1173
|
-
}
|
|
1174
|
-
StatsElem(node: any, context: any): {
|
|
1175
|
-
StatsElem: any;
|
|
1176
|
-
} {
|
|
1177
|
-
return { StatsElem: node as any };
|
|
1178
|
-
}
|
|
1179
|
-
CreatePublicationStmt(node: any, context: any): {
|
|
1180
|
-
CreatePublicationStmt: any;
|
|
1181
|
-
} {
|
|
1182
|
-
return { CreatePublicationStmt: node as any };
|
|
1183
|
-
}
|
|
1184
|
-
CreateSubscriptionStmt(node: any, context: any): {
|
|
1185
|
-
CreateSubscriptionStmt: any;
|
|
1186
|
-
} {
|
|
1187
|
-
return { CreateSubscriptionStmt: node as any };
|
|
1188
|
-
}
|
|
1189
|
-
AlterPublicationStmt(node: any, context: any): {
|
|
1190
|
-
AlterPublicationStmt: any;
|
|
1191
|
-
} {
|
|
1192
|
-
return { AlterPublicationStmt: node as any };
|
|
1193
|
-
}
|
|
1194
|
-
AlterSubscriptionStmt(node: any, context: any): {
|
|
1195
|
-
AlterSubscriptionStmt: any;
|
|
1196
|
-
} {
|
|
1197
|
-
return { AlterSubscriptionStmt: node as any };
|
|
1198
|
-
}
|
|
1199
|
-
DropSubscriptionStmt(node: any, context: any): {
|
|
1200
|
-
DropSubscriptionStmt: any;
|
|
1201
|
-
} {
|
|
1202
|
-
return { DropSubscriptionStmt: node as any };
|
|
1203
|
-
}
|
|
1204
|
-
DoStmt(node: any, context: any): {
|
|
1205
|
-
DoStmt: any;
|
|
1206
|
-
} {
|
|
1207
|
-
return { DoStmt: node as any };
|
|
1208
|
-
}
|
|
1209
|
-
InlineCodeBlock(node: any, context: any): {
|
|
1210
|
-
InlineCodeBlock: any;
|
|
1211
|
-
} {
|
|
1212
|
-
return { InlineCodeBlock: node as any };
|
|
1213
|
-
}
|
|
1214
|
-
CallContext(node: any, context: any): {
|
|
1215
|
-
CallContext: any;
|
|
1216
|
-
} {
|
|
1217
|
-
return { CallContext: node as any };
|
|
1218
|
-
}
|
|
1219
|
-
ConstraintsSetStmt(node: any, context: any): {
|
|
1220
|
-
ConstraintsSetStmt: any;
|
|
1221
|
-
} {
|
|
1222
|
-
return { ConstraintsSetStmt: node as any };
|
|
1223
|
-
}
|
|
1224
|
-
AlterSystemStmt(node: any, context: any): {
|
|
1225
|
-
AlterSystemStmt: any;
|
|
1226
|
-
} {
|
|
1227
|
-
return { AlterSystemStmt: node as any };
|
|
1228
|
-
}
|
|
1229
|
-
VacuumRelation(node: any, context: any): {
|
|
1230
|
-
VacuumRelation: any;
|
|
1231
|
-
} {
|
|
1232
|
-
return { VacuumRelation: node as any };
|
|
1233
|
-
}
|
|
1234
|
-
DropOwnedStmt(node: any, context: any): {
|
|
1235
|
-
DropOwnedStmt: any;
|
|
1236
|
-
} {
|
|
1237
|
-
return { DropOwnedStmt: node as any };
|
|
1238
|
-
}
|
|
1239
|
-
ReassignOwnedStmt(node: any, context: any): {
|
|
1240
|
-
ReassignOwnedStmt: any;
|
|
1241
|
-
} {
|
|
1242
|
-
return { ReassignOwnedStmt: node as any };
|
|
1243
|
-
}
|
|
1244
|
-
AlterTSDictionaryStmt(node: any, context: any): {
|
|
1245
|
-
AlterTSDictionaryStmt: any;
|
|
1246
|
-
} {
|
|
1247
|
-
return { AlterTSDictionaryStmt: node as any };
|
|
1248
|
-
}
|
|
1249
|
-
AlterTSConfigurationStmt(node: any, context: any): {
|
|
1250
|
-
AlterTSConfigurationStmt: any;
|
|
1251
|
-
} {
|
|
1252
|
-
return { AlterTSConfigurationStmt: node as any };
|
|
1253
|
-
}
|
|
1254
|
-
ClosePortalStmt(node: any, context: any): {
|
|
1255
|
-
ClosePortalStmt: any;
|
|
1256
|
-
} {
|
|
1257
|
-
return { ClosePortalStmt: node as any };
|
|
1258
|
-
}
|
|
1259
|
-
FetchStmt(node: any, context: any): {
|
|
1260
|
-
FetchStmt: any;
|
|
1261
|
-
} {
|
|
1262
|
-
return { FetchStmt: node as any };
|
|
1263
|
-
}
|
|
1264
|
-
AlterStatsStmt(node: any, context: any): {
|
|
1265
|
-
AlterStatsStmt: any;
|
|
1266
|
-
} {
|
|
1267
|
-
return { AlterStatsStmt: node as any };
|
|
1268
|
-
}
|
|
1269
|
-
ObjectWithArgs(node: any, context: any): {
|
|
1270
|
-
ObjectWithArgs: any;
|
|
1271
|
-
} {
|
|
1272
|
-
return { ObjectWithArgs: node as any };
|
|
1273
|
-
}
|
|
1274
|
-
AlterOperatorStmt(node: any, context: any): {
|
|
1275
|
-
AlterOperatorStmt: any;
|
|
1276
|
-
} {
|
|
1277
|
-
return { AlterOperatorStmt: node as any };
|
|
1278
|
-
}
|
|
1279
|
-
AlterFdwStmt(node: any, context: any): {
|
|
1280
|
-
AlterFdwStmt: any;
|
|
1281
|
-
} {
|
|
1282
|
-
return { AlterFdwStmt: node as any };
|
|
1283
|
-
}
|
|
1284
|
-
CreateForeignServerStmt(node: any, context: any): {
|
|
1285
|
-
CreateForeignServerStmt: any;
|
|
1286
|
-
} {
|
|
1287
|
-
return { CreateForeignServerStmt: node as any };
|
|
1288
|
-
}
|
|
1289
|
-
AlterForeignServerStmt(node: any, context: any): {
|
|
1290
|
-
AlterForeignServerStmt: any;
|
|
1291
|
-
} {
|
|
1292
|
-
return { AlterForeignServerStmt: node as any };
|
|
1293
|
-
}
|
|
1294
|
-
AlterUserMappingStmt(node: any, context: any): {
|
|
1295
|
-
AlterUserMappingStmt: any;
|
|
1296
|
-
} {
|
|
1297
|
-
return { AlterUserMappingStmt: node as any };
|
|
1298
|
-
}
|
|
1299
|
-
DropUserMappingStmt(node: any, context: any): {
|
|
1300
|
-
DropUserMappingStmt: any;
|
|
1301
|
-
} {
|
|
1302
|
-
return { DropUserMappingStmt: node as any };
|
|
1303
|
-
}
|
|
1304
|
-
ImportForeignSchemaStmt(node: any, context: any): {
|
|
1305
|
-
ImportForeignSchemaStmt: any;
|
|
1306
|
-
} {
|
|
1307
|
-
return { ImportForeignSchemaStmt: node as any };
|
|
1308
|
-
}
|
|
1309
|
-
ClusterStmt(node: any, context: any): {
|
|
1310
|
-
ClusterStmt: any;
|
|
1311
|
-
} {
|
|
1312
|
-
return { ClusterStmt: node as any };
|
|
1313
|
-
}
|
|
1314
|
-
VacuumStmt(node: any, context: any): {
|
|
1315
|
-
VacuumStmt: any;
|
|
1316
|
-
} {
|
|
1317
|
-
return { VacuumStmt: node as any };
|
|
1318
|
-
}
|
|
1319
|
-
ExplainStmt(node: any, context: any): {
|
|
1320
|
-
ExplainStmt: any;
|
|
1321
|
-
} {
|
|
1322
|
-
return { ExplainStmt: node as any };
|
|
1323
|
-
}
|
|
1324
|
-
ReindexStmt(node: any, context: any): {
|
|
1325
|
-
ReindexStmt: any;
|
|
1326
|
-
} {
|
|
1327
|
-
return { ReindexStmt: node as any };
|
|
1328
|
-
}
|
|
1329
|
-
CallStmt(node: any, context: any): {
|
|
1330
|
-
CallStmt: any;
|
|
1331
|
-
} {
|
|
1332
|
-
return { CallStmt: node as any };
|
|
1333
|
-
}
|
|
1334
|
-
CreatedbStmt(node: any, context: any): {
|
|
1335
|
-
CreatedbStmt: any;
|
|
1336
|
-
} {
|
|
1337
|
-
return { CreatedbStmt: node as any };
|
|
1338
|
-
}
|
|
1339
|
-
DropdbStmt(node: any, context: any): {
|
|
1340
|
-
DropdbStmt: any;
|
|
1341
|
-
} {
|
|
1342
|
-
return { DropdbStmt: node as any };
|
|
1343
|
-
}
|
|
1344
|
-
RenameStmt(node: any, context: any): {
|
|
1345
|
-
RenameStmt: any;
|
|
1346
|
-
} {
|
|
1347
|
-
return { RenameStmt: node as any };
|
|
1348
|
-
}
|
|
1349
|
-
AlterOwnerStmt(node: any, context: any): {
|
|
1350
|
-
AlterOwnerStmt: any;
|
|
1351
|
-
} {
|
|
1352
|
-
return { AlterOwnerStmt: node as any };
|
|
1353
|
-
}
|
|
1354
|
-
GrantStmt(node: any, context: any): {
|
|
1355
|
-
GrantStmt: any;
|
|
1356
|
-
} {
|
|
1357
|
-
return { GrantStmt: node as any };
|
|
1358
|
-
}
|
|
1359
|
-
GrantRoleStmt(node: any, context: any): {
|
|
1360
|
-
GrantRoleStmt: any;
|
|
1361
|
-
} {
|
|
1362
|
-
return { GrantRoleStmt: node as any };
|
|
1363
|
-
}
|
|
1364
|
-
SecLabelStmt(node: any, context: any): {
|
|
1365
|
-
SecLabelStmt: any;
|
|
1366
|
-
} {
|
|
1367
|
-
return { SecLabelStmt: node as any };
|
|
1368
|
-
}
|
|
1369
|
-
AlterDefaultPrivilegesStmt(node: any, context: any): {
|
|
1370
|
-
AlterDefaultPrivilegesStmt: any;
|
|
1371
|
-
} {
|
|
1372
|
-
return { AlterDefaultPrivilegesStmt: node as any };
|
|
1373
|
-
}
|
|
1374
|
-
CreateConversionStmt(node: any, context: any): {
|
|
1375
|
-
CreateConversionStmt: any;
|
|
1376
|
-
} {
|
|
1377
|
-
return { CreateConversionStmt: node as any };
|
|
1378
|
-
}
|
|
1379
|
-
CreateCastStmt(node: any, context: any): {
|
|
1380
|
-
CreateCastStmt: any;
|
|
1381
|
-
} {
|
|
1382
|
-
return { CreateCastStmt: node as any };
|
|
1383
|
-
}
|
|
1384
|
-
CreatePLangStmt(node: any, context: any): {
|
|
1385
|
-
CreatePLangStmt: any;
|
|
1386
|
-
} {
|
|
1387
|
-
return { CreatePLangStmt: node as any };
|
|
1388
|
-
}
|
|
1389
|
-
CreateTransformStmt(node: any, context: any): {
|
|
1390
|
-
CreateTransformStmt: any;
|
|
1391
|
-
} {
|
|
1392
|
-
return { CreateTransformStmt: node as any };
|
|
1393
|
-
}
|
|
1394
|
-
CreateTrigStmt(node: any, context: any): {
|
|
1395
|
-
CreateTrigStmt: any;
|
|
1396
|
-
} {
|
|
1397
|
-
return { CreateTrigStmt: node as any };
|
|
1398
|
-
}
|
|
1399
|
-
TriggerTransition(node: any, context: any): {
|
|
1400
|
-
TriggerTransition: any;
|
|
1401
|
-
} {
|
|
1402
|
-
return { TriggerTransition: node as any };
|
|
1403
|
-
}
|
|
1404
|
-
CreateEventTrigStmt(node: any, context: any): {
|
|
1405
|
-
CreateEventTrigStmt: any;
|
|
1406
|
-
} {
|
|
1407
|
-
return { CreateEventTrigStmt: node as any };
|
|
1408
|
-
}
|
|
1409
|
-
AlterEventTrigStmt(node: any, context: any): {
|
|
1410
|
-
AlterEventTrigStmt: any;
|
|
1411
|
-
} {
|
|
1412
|
-
return { AlterEventTrigStmt: node as any };
|
|
1413
|
-
}
|
|
1414
|
-
CreateOpClassStmt(node: any, context: any): {
|
|
1415
|
-
CreateOpClassStmt: any;
|
|
1416
|
-
} {
|
|
1417
|
-
return { CreateOpClassStmt: node as any };
|
|
1418
|
-
}
|
|
1419
|
-
CreateOpFamilyStmt(node: any, context: any): {
|
|
1420
|
-
CreateOpFamilyStmt: any;
|
|
1421
|
-
} {
|
|
1422
|
-
return { CreateOpFamilyStmt: node as any };
|
|
1423
|
-
}
|
|
1424
|
-
AlterOpFamilyStmt(node: any, context: any): {
|
|
1425
|
-
AlterOpFamilyStmt: any;
|
|
1426
|
-
} {
|
|
1427
|
-
return { AlterOpFamilyStmt: node as any };
|
|
1428
|
-
}
|
|
1429
|
-
MergeStmt(node: any, context: any): {
|
|
1430
|
-
MergeStmt: any;
|
|
1431
|
-
} {
|
|
1432
|
-
return { MergeStmt: node as any };
|
|
1433
|
-
}
|
|
1434
|
-
AlterTableMoveAllStmt(node: any, context: any): {
|
|
1435
|
-
AlterTableMoveAllStmt: any;
|
|
1436
|
-
} {
|
|
1437
|
-
return { AlterTableMoveAllStmt: node as any };
|
|
1438
|
-
}
|
|
1439
|
-
CreateSeqStmt(node: any, context: any): {
|
|
1440
|
-
CreateSeqStmt: any;
|
|
1441
|
-
} {
|
|
1442
|
-
return { CreateSeqStmt: node as any };
|
|
1443
|
-
}
|
|
1444
|
-
AlterSeqStmt(node: any, context: any): {
|
|
1445
|
-
AlterSeqStmt: any;
|
|
1446
|
-
} {
|
|
1447
|
-
return { AlterSeqStmt: node as any };
|
|
1448
|
-
}
|
|
1449
|
-
CompositeTypeStmt(node: any, context: any): {
|
|
1450
|
-
CompositeTypeStmt: any;
|
|
1451
|
-
} {
|
|
1452
|
-
const result: any = {};
|
|
1453
|
-
if (node.typevar !== undefined) {
|
|
1454
|
-
result.typevar = this.transform(node.typevar as any, context);
|
|
1455
|
-
}
|
|
1456
|
-
if (node.coldeflist !== undefined) {
|
|
1457
|
-
result.coldeflist = Array.isArray(node.coldeflist)
|
|
1458
|
-
? node.coldeflist.map(item => this.transform(item as any, context))
|
|
1459
|
-
: this.transform(node.coldeflist as any, context);
|
|
1460
|
-
}
|
|
1461
|
-
return { CompositeTypeStmt: result };
|
|
1462
|
-
}
|
|
1463
|
-
CreateRangeStmt(node: any, context: any): {
|
|
1464
|
-
CreateRangeStmt: any;
|
|
1465
|
-
} {
|
|
1466
|
-
return { CreateRangeStmt: node as any };
|
|
1467
|
-
}
|
|
1468
|
-
AlterEnumStmt(node: any, context: any): {
|
|
1469
|
-
AlterEnumStmt: any;
|
|
1470
|
-
} {
|
|
1471
|
-
return { AlterEnumStmt: node as any };
|
|
1472
|
-
}
|
|
1473
|
-
AlterTypeStmt(node: any, context: any): {
|
|
1474
|
-
AlterTypeStmt: any;
|
|
1475
|
-
} {
|
|
1476
|
-
return { AlterTypeStmt: node as any };
|
|
1477
|
-
}
|
|
1478
|
-
AlterRoleStmt(node: any, context: any): {
|
|
1479
|
-
AlterRoleStmt: any;
|
|
1480
|
-
} {
|
|
1481
|
-
return { AlterRoleStmt: node as any };
|
|
1482
|
-
}
|
|
1483
|
-
DropRoleStmt(node: any, context: any): {
|
|
1484
|
-
DropRoleStmt: any;
|
|
1485
|
-
} {
|
|
1486
|
-
return { DropRoleStmt: node as any };
|
|
1487
|
-
}
|
|
1488
|
-
// NOTE PG 17 has a no CreateAggregateStmt?
|
|
1489
|
-
// In PostgreSQL 17, the CreateAggregateStmt has been removed from the backend parser infrastructure and replaced by CreateFunctionStmt with a kind = OBJECT_AGGREGATE variant.
|
|
1490
|
-
CreateAggregateStmt(node: any, context: any): any {
|
|
1491
|
-
return { CreateAggregateStmt: node };
|
|
1492
|
-
}
|
|
1493
|
-
CreateTableAsStmt(node: any, context: any): {
|
|
1494
|
-
CreateTableAsStmt: any;
|
|
1495
|
-
} {
|
|
1496
|
-
return { CreateTableAsStmt: node as any };
|
|
1497
|
-
}
|
|
1498
|
-
RefreshMatViewStmt(node: any, context: any): {
|
|
1499
|
-
RefreshMatViewStmt: any;
|
|
1500
|
-
} {
|
|
1501
|
-
return { RefreshMatViewStmt: node as any };
|
|
1502
|
-
}
|
|
1503
|
-
AccessPriv(node: any, context: any): {
|
|
1504
|
-
AccessPriv: any;
|
|
1505
|
-
} {
|
|
1506
|
-
return { AccessPriv: node as any };
|
|
1507
|
-
}
|
|
1508
|
-
DefineStmt(node: any, context: any): {
|
|
1509
|
-
DefineStmt: any;
|
|
1510
|
-
} {
|
|
1511
|
-
return { DefineStmt: node as any };
|
|
1512
|
-
}
|
|
1513
|
-
AlterDatabaseStmt(node: any, context: any): {
|
|
1514
|
-
AlterDatabaseStmt: any;
|
|
1515
|
-
} {
|
|
1516
|
-
return { AlterDatabaseStmt: node as any };
|
|
1517
|
-
}
|
|
1518
|
-
AlterDatabaseRefreshCollStmt(node: any, context: any): {
|
|
1519
|
-
AlterDatabaseRefreshCollStmt: any;
|
|
1520
|
-
} {
|
|
1521
|
-
return { AlterDatabaseRefreshCollStmt: node as any };
|
|
1522
|
-
}
|
|
1523
|
-
AlterDatabaseSetStmt(node: any, context: any): {
|
|
1524
|
-
AlterDatabaseSetStmt: any;
|
|
1525
|
-
} {
|
|
1526
|
-
return { AlterDatabaseSetStmt: node as any };
|
|
1527
|
-
}
|
|
1528
|
-
DeclareCursorStmt(node: any, context: any): {
|
|
1529
|
-
DeclareCursorStmt: any;
|
|
1530
|
-
} {
|
|
1531
|
-
return { DeclareCursorStmt: node as any };
|
|
1532
|
-
}
|
|
1533
|
-
PublicationObjSpec(node: any, context: any): {
|
|
1534
|
-
PublicationObjSpec: any;
|
|
1535
|
-
} {
|
|
1536
|
-
return { PublicationObjSpec: node as any };
|
|
1537
|
-
}
|
|
1538
|
-
PublicationTable(node: any, context: any): {
|
|
1539
|
-
PublicationTable: any;
|
|
1540
|
-
} {
|
|
1541
|
-
return { PublicationTable: node as any };
|
|
1542
|
-
}
|
|
1543
|
-
CreateAmStmt(node: any, context: any): {
|
|
1544
|
-
CreateAmStmt: any;
|
|
1545
|
-
} {
|
|
1546
|
-
return { CreateAmStmt: node as any };
|
|
1547
|
-
}
|
|
1548
|
-
IntoClause(node: any, context: any): {
|
|
1549
|
-
IntoClause: any;
|
|
1550
|
-
} {
|
|
1551
|
-
return { IntoClause: node as any };
|
|
1552
|
-
}
|
|
1553
|
-
OnConflictExpr(node: any, context: any): {
|
|
1554
|
-
OnConflictExpr: any;
|
|
1555
|
-
} {
|
|
1556
|
-
return { OnConflictExpr: node as any };
|
|
1557
|
-
}
|
|
1558
|
-
ScanToken(node: any, context: any): {
|
|
1559
|
-
ScanToken: any;
|
|
1560
|
-
} {
|
|
1561
|
-
return { ScanToken: node as any };
|
|
1562
|
-
}
|
|
1563
|
-
CreateOpClassItem(node: any, context: any): {
|
|
1564
|
-
CreateOpClassItem: any;
|
|
1565
|
-
} {
|
|
1566
|
-
return { CreateOpClassItem: node as any };
|
|
1567
|
-
}
|
|
1568
|
-
Var(node: any, context: any): {
|
|
1569
|
-
Var: any;
|
|
1570
|
-
} {
|
|
1571
|
-
return { Var: node as any };
|
|
1572
|
-
}
|
|
1573
|
-
TableFunc(node: any, context: any): {
|
|
1574
|
-
TableFunc: any;
|
|
1575
|
-
} {
|
|
1576
|
-
return { TableFunc: node as any };
|
|
1577
|
-
}
|
|
1578
|
-
RangeTableFunc(node: any, context: any): {
|
|
1579
|
-
RangeTableFunc: any;
|
|
1580
|
-
} {
|
|
1581
|
-
return { RangeTableFunc: node as any };
|
|
1582
|
-
}
|
|
1583
|
-
RangeTableFuncCol(node: any, context: any): {
|
|
1584
|
-
RangeTableFuncCol: any;
|
|
1585
|
-
} {
|
|
1586
|
-
return { RangeTableFuncCol: node as any };
|
|
1587
|
-
}
|
|
1588
|
-
JsonArrayQueryConstructor(node: any, context: any): {
|
|
1589
|
-
JsonArrayQueryConstructor: any;
|
|
1590
|
-
} {
|
|
1591
|
-
return { JsonArrayQueryConstructor: node as any };
|
|
1592
|
-
}
|
|
1593
|
-
RangeFunction(node: any, context: any): {
|
|
1594
|
-
RangeFunction: any;
|
|
1595
|
-
} {
|
|
1596
|
-
const result: any = {};
|
|
1597
|
-
if (node.lateral !== undefined) {
|
|
1598
|
-
result.lateral = node.lateral;
|
|
1599
|
-
}
|
|
1600
|
-
if (node.ordinality !== undefined) {
|
|
1601
|
-
result.ordinality = node.ordinality;
|
|
1602
|
-
}
|
|
1603
|
-
if (node.is_rowsfrom !== undefined) {
|
|
1604
|
-
result.is_rowsfrom = node.is_rowsfrom;
|
|
1605
|
-
}
|
|
1606
|
-
if (node.functions !== undefined) {
|
|
1607
|
-
result.functions = Array.isArray(node.functions)
|
|
1608
|
-
? node.functions.map(item => this.transform(item as any, context))
|
|
1609
|
-
: this.transform(node.functions as any, context);
|
|
1610
|
-
}
|
|
1611
|
-
if (node.alias !== undefined) {
|
|
1612
|
-
result.alias = this.transform(node.alias as any, context);
|
|
1613
|
-
}
|
|
1614
|
-
if (node.coldeflist !== undefined) {
|
|
1615
|
-
result.coldeflist = Array.isArray(node.coldeflist)
|
|
1616
|
-
? node.coldeflist.map(item => this.transform(item as any, context))
|
|
1617
|
-
: this.transform(node.coldeflist as any, context);
|
|
1618
|
-
}
|
|
1619
|
-
return { RangeFunction: result };
|
|
1620
|
-
}
|
|
1621
|
-
XmlSerialize(node: any, context: any): {
|
|
1622
|
-
XmlSerialize: any;
|
|
1623
|
-
} {
|
|
1624
|
-
const result: any = {};
|
|
1625
|
-
if (node.xmloption !== undefined) {
|
|
1626
|
-
result.xmloption = node.xmloption;
|
|
1627
|
-
}
|
|
1628
|
-
if (node.expr !== undefined) {
|
|
1629
|
-
result.expr = this.transform(node.expr as any, context);
|
|
1630
|
-
}
|
|
1631
|
-
if (node.typeName !== undefined) {
|
|
1632
|
-
result.typeName = this.transform(node.typeName as any, context);
|
|
1633
|
-
}
|
|
1634
|
-
if (node.location !== undefined) {
|
|
1635
|
-
result.location = node.location;
|
|
1636
|
-
}
|
|
1637
|
-
return { XmlSerialize: result };
|
|
1638
|
-
}
|
|
1639
|
-
RuleStmt(node: any, context: any): {
|
|
1640
|
-
RuleStmt: any;
|
|
1641
|
-
} {
|
|
1642
|
-
return { RuleStmt: node as any };
|
|
1643
|
-
}
|
|
1644
|
-
GroupingFunc(node: any, context: any): {
|
|
1645
|
-
GroupingFunc: any;
|
|
1646
|
-
} {
|
|
1647
|
-
const result: any = {};
|
|
1648
|
-
if (node.args !== undefined) {
|
|
1649
|
-
result.args = Array.isArray(node.args)
|
|
1650
|
-
? node.args.map((item: any) => this.transform(item as any, context))
|
|
1651
|
-
: this.transform(node.args as any, context);
|
|
1652
|
-
}
|
|
1653
|
-
if (node.refs !== undefined) {
|
|
1654
|
-
result.refs = Array.isArray(node.refs)
|
|
1655
|
-
? node.refs.map((item: any) => this.transform(item as any, context))
|
|
1656
|
-
: this.transform(node.refs as any, context);
|
|
1657
|
-
}
|
|
1658
|
-
if (node.agglevelsup !== undefined) {
|
|
1659
|
-
result.agglevelsup = node.agglevelsup;
|
|
1660
|
-
}
|
|
1661
|
-
if (node.location !== undefined) {
|
|
1662
|
-
result.location = node.location;
|
|
1663
|
-
}
|
|
1664
|
-
return { GroupingFunc: result };
|
|
1665
|
-
}
|
|
1666
|
-
MultiAssignRef(node: any, context: any): {
|
|
1667
|
-
MultiAssignRef: any;
|
|
1668
|
-
} {
|
|
1669
|
-
const result: any = {};
|
|
1670
|
-
if (node.source !== undefined) {
|
|
1671
|
-
result.source = this.transform(node.source as any, context);
|
|
1672
|
-
}
|
|
1673
|
-
if (node.colno !== undefined) {
|
|
1674
|
-
result.colno = node.colno;
|
|
1675
|
-
}
|
|
1676
|
-
if (node.ncolumns !== undefined) {
|
|
1677
|
-
result.ncolumns = node.ncolumns;
|
|
1678
|
-
}
|
|
1679
|
-
return { MultiAssignRef: result };
|
|
1680
|
-
}
|
|
1681
|
-
CurrentOfExpr(node: any, context: any): {
|
|
1682
|
-
CurrentOfExpr: any;
|
|
1683
|
-
} {
|
|
1684
|
-
const result: any = {};
|
|
1685
|
-
if (node.cursor_name !== undefined) {
|
|
1686
|
-
result.cursor_name = node.cursor_name;
|
|
1687
|
-
}
|
|
1688
|
-
if (node.cursor_param !== undefined) {
|
|
1689
|
-
result.cursor_param = node.cursor_param;
|
|
1690
|
-
}
|
|
1691
|
-
return { CurrentOfExpr: result };
|
|
1692
|
-
}
|
|
1693
|
-
TableLikeClause(node: any, context: any): {
|
|
1694
|
-
TableLikeClause: any;
|
|
1695
|
-
} {
|
|
1696
|
-
return { TableLikeClause: node as any };
|
|
1697
|
-
}
|
|
1698
|
-
AlterFunctionStmt(node: any, context: any): {
|
|
1699
|
-
AlterFunctionStmt: any;
|
|
1700
|
-
} {
|
|
1701
|
-
return { AlterFunctionStmt: node as any };
|
|
1702
|
-
}
|
|
1703
|
-
AlterObjectSchemaStmt(node: any, context: any): {
|
|
1704
|
-
AlterObjectSchemaStmt: any;
|
|
1705
|
-
} {
|
|
1706
|
-
return { AlterObjectSchemaStmt: node as any };
|
|
1707
|
-
}
|
|
1708
|
-
AlterRoleSetStmt(node: any, context: any): {
|
|
1709
|
-
AlterRoleSetStmt: any;
|
|
1710
|
-
} {
|
|
1711
|
-
const result: any = {};
|
|
1712
|
-
if (node.role !== undefined) {
|
|
1713
|
-
result.role = this.transform(node.role as any, context);
|
|
1714
|
-
}
|
|
1715
|
-
if (node.database !== undefined) {
|
|
1716
|
-
result.database = node.database;
|
|
1717
|
-
}
|
|
1718
|
-
if (node.setstmt !== undefined) {
|
|
1719
|
-
result.setstmt = this.transform(node.setstmt as any, context);
|
|
1720
|
-
}
|
|
1721
|
-
return { AlterRoleSetStmt: result };
|
|
1722
|
-
}
|
|
1723
|
-
CreateForeignTableStmt(node: any, context: any): {
|
|
1724
|
-
CreateForeignTableStmt: any;
|
|
1725
|
-
} {
|
|
1726
|
-
return { CreateForeignTableStmt: node as any };
|
|
1727
|
-
}
|
|
1728
|
-
private getFuncformatValue(node: any, funcname: any, context: any): string {
|
|
1729
|
-
const functionName = this.getFunctionName(node, funcname);
|
|
1730
|
-
if (!functionName) {
|
|
1731
|
-
return 'COERCE_EXPLICIT_CALL';
|
|
1732
|
-
}
|
|
1733
|
-
const hasPgCatalogPrefix = this.hasPgCatalogPrefix(funcname);
|
|
1734
|
-
const sqlSyntaxFunctions = [
|
|
1735
|
-
'trim', 'ltrim', 'rtrim', 'btrim',
|
|
1736
|
-
'position', 'overlay', 'substring',
|
|
1737
|
-
'extract', 'timezone', 'xmlexists',
|
|
1738
|
-
'current_date', 'current_time', 'current_timestamp',
|
|
1739
|
-
'localtime', 'localtimestamp', 'overlaps'
|
|
1740
|
-
];
|
|
1741
|
-
// Handle specific functions that depend on pg_catalog prefix
|
|
1742
|
-
if (functionName.toLowerCase() === 'substring') {
|
|
1743
|
-
if (hasPgCatalogPrefix) {
|
|
1744
|
-
return 'COERCE_SQL_SYNTAX';
|
|
1745
|
-
}
|
|
1746
|
-
return 'COERCE_EXPLICIT_CALL';
|
|
1747
|
-
}
|
|
1748
|
-
if (functionName.toLowerCase() === 'ltrim') {
|
|
1749
|
-
if (hasPgCatalogPrefix) {
|
|
1750
|
-
return 'COERCE_SQL_SYNTAX';
|
|
1751
|
-
}
|
|
1752
|
-
return 'COERCE_EXPLICIT_CALL';
|
|
1753
|
-
}
|
|
1754
|
-
if (functionName.toLowerCase() === 'btrim') {
|
|
1755
|
-
if (hasPgCatalogPrefix) {
|
|
1756
|
-
return 'COERCE_SQL_SYNTAX';
|
|
1757
|
-
}
|
|
1758
|
-
return 'COERCE_EXPLICIT_CALL';
|
|
1759
|
-
}
|
|
1760
|
-
if (functionName.toLowerCase() === 'pg_collation_for') {
|
|
1761
|
-
if (hasPgCatalogPrefix) {
|
|
1762
|
-
return 'COERCE_SQL_SYNTAX';
|
|
1763
|
-
}
|
|
1764
|
-
return 'COERCE_EXPLICIT_CALL';
|
|
1765
|
-
}
|
|
1766
|
-
if (sqlSyntaxFunctions.includes(functionName.toLowerCase())) {
|
|
1767
|
-
return 'COERCE_SQL_SYNTAX';
|
|
1768
|
-
}
|
|
1769
|
-
return 'COERCE_EXPLICIT_CALL';
|
|
1770
|
-
}
|
|
1771
|
-
private getFunctionName(node: any, funcname?: any): string | null {
|
|
1772
|
-
const names = funcname || node?.funcname;
|
|
1773
|
-
if (names && Array.isArray(names) && names.length > 0) {
|
|
1774
|
-
const lastName = names[names.length - 1];
|
|
1775
|
-
if (lastName && typeof lastName === 'object' && 'String' in lastName) {
|
|
1776
|
-
return lastName.String.str || lastName.String.sval;
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
return null;
|
|
1780
|
-
}
|
|
1781
|
-
private hasPgCatalogPrefix(funcname: any): boolean {
|
|
1782
|
-
if (funcname && Array.isArray(funcname) && funcname.length >= 2) {
|
|
1783
|
-
const firstElement = funcname[0];
|
|
1784
|
-
if (firstElement && typeof firstElement === 'object' && 'String' in firstElement) {
|
|
1785
|
-
const prefix = firstElement.String.str || firstElement.String.sval;
|
|
1786
|
-
return prefix === 'pg_catalog';
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
return false;
|
|
1790
|
-
}
|
|
1791
|
-
RangeTableSample(node: any, context: any): {
|
|
1792
|
-
RangeTableSample: any;
|
|
1793
|
-
} {
|
|
1794
|
-
const result: any = {};
|
|
1795
|
-
if (node.relation !== undefined) {
|
|
1796
|
-
result.relation = this.transform(node.relation as any, context);
|
|
1797
|
-
}
|
|
1798
|
-
if (node.method !== undefined) {
|
|
1799
|
-
result.method = Array.isArray(node.method)
|
|
1800
|
-
? node.method.map(item => this.transform(item as any, context))
|
|
1801
|
-
: this.transform(node.method as any, context);
|
|
1802
|
-
}
|
|
1803
|
-
if (node.args !== undefined) {
|
|
1804
|
-
result.args = Array.isArray(node.args)
|
|
1805
|
-
? node.args.map(item => this.transform(item as any, context))
|
|
1806
|
-
: this.transform(node.args as any, context);
|
|
1807
|
-
}
|
|
1808
|
-
if (node.repeatable !== undefined) {
|
|
1809
|
-
result.repeatable = this.transform(node.repeatable as any, context);
|
|
1810
|
-
}
|
|
1811
|
-
if (node.location !== undefined) {
|
|
1812
|
-
result.location = node.location;
|
|
1813
|
-
}
|
|
1814
|
-
return { RangeTableSample: result };
|
|
1815
|
-
}
|
|
1816
|
-
SQLValueFunction(node: any, context: any): {
|
|
1817
|
-
SQLValueFunction: any;
|
|
1818
|
-
} {
|
|
1819
|
-
const result: any = {};
|
|
1820
|
-
if (node.op !== undefined) {
|
|
1821
|
-
result.op = node.op;
|
|
1822
|
-
}
|
|
1823
|
-
if (node.type !== undefined) {
|
|
1824
|
-
result.type = node.type;
|
|
1825
|
-
}
|
|
1826
|
-
if (node.typmod !== undefined) {
|
|
1827
|
-
result.typmod = node.typmod;
|
|
1828
|
-
}
|
|
1829
|
-
if (node.location !== undefined) {
|
|
1830
|
-
result.location = node.location;
|
|
1831
|
-
}
|
|
1832
|
-
return { SQLValueFunction: result };
|
|
1833
|
-
}
|
|
1834
|
-
XmlExpr(node: any, context: any): {
|
|
1835
|
-
XmlExpr: any;
|
|
1836
|
-
} {
|
|
1837
|
-
const result: any = {};
|
|
1838
|
-
if (node.op !== undefined) {
|
|
1839
|
-
result.op = node.op;
|
|
1840
|
-
}
|
|
1841
|
-
if (node.name !== undefined) {
|
|
1842
|
-
result.name = node.name;
|
|
1843
|
-
}
|
|
1844
|
-
if (node.named_args !== undefined) {
|
|
1845
|
-
result.named_args = Array.isArray(node.named_args)
|
|
1846
|
-
? node.named_args.map(item => this.transform(item as any, context))
|
|
1847
|
-
: this.transform(node.named_args as any, context);
|
|
1848
|
-
}
|
|
1849
|
-
if (node.arg_names !== undefined) {
|
|
1850
|
-
result.arg_names = Array.isArray(node.arg_names)
|
|
1851
|
-
? node.arg_names.map(item => this.transform(item as any, context))
|
|
1852
|
-
: this.transform(node.arg_names as any, context);
|
|
1853
|
-
}
|
|
1854
|
-
if (node.args !== undefined) {
|
|
1855
|
-
result.args = Array.isArray(node.args)
|
|
1856
|
-
? node.args.map(item => this.transform(item as any, context))
|
|
1857
|
-
: this.transform(node.args as any, context);
|
|
1858
|
-
}
|
|
1859
|
-
if (node.xmloption !== undefined) {
|
|
1860
|
-
result.xmloption = node.xmloption;
|
|
1861
|
-
}
|
|
1862
|
-
if (node.type !== undefined) {
|
|
1863
|
-
result.type = node.type;
|
|
1864
|
-
}
|
|
1865
|
-
if (node.typmod !== undefined) {
|
|
1866
|
-
result.typmod = node.typmod;
|
|
1867
|
-
}
|
|
1868
|
-
if (node.location !== undefined) {
|
|
1869
|
-
result.location = node.location;
|
|
1870
|
-
}
|
|
1871
|
-
return { XmlExpr: result };
|
|
1872
|
-
}
|
|
1873
|
-
RangeSubselect(node: any, context: any): {
|
|
1874
|
-
RangeSubselect: any;
|
|
1875
|
-
} {
|
|
1876
|
-
const result: any = {};
|
|
1877
|
-
if (node.lateral !== undefined) {
|
|
1878
|
-
result.lateral = node.lateral;
|
|
1879
|
-
}
|
|
1880
|
-
if (node.subquery !== undefined) {
|
|
1881
|
-
result.subquery = this.transform(node.subquery as any, context);
|
|
1882
|
-
}
|
|
1883
|
-
if (node.alias !== undefined) {
|
|
1884
|
-
result.alias = this.transform(node.alias as any, context);
|
|
1885
|
-
}
|
|
1886
|
-
return { RangeSubselect: result };
|
|
1887
|
-
}
|
|
1888
|
-
SetToDefault(node: any, context: any): {
|
|
1889
|
-
SetToDefault: any;
|
|
1890
|
-
} {
|
|
1891
|
-
const result: any = {};
|
|
1892
|
-
if (node.location !== undefined) {
|
|
1893
|
-
result.location = node.location;
|
|
1894
|
-
}
|
|
1895
|
-
return { SetToDefault: result };
|
|
1896
|
-
}
|
|
1897
|
-
}
|