pgsql-deparser 17.12.2 → 17.13.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.
- package/README.md +1 -1
- package/deparser.d.ts +0 -2
- package/deparser.js +179 -223
- package/esm/deparser.js +179 -223
- package/esm/kwlist.js +531 -0
- package/esm/utils/quote-utils.js +77 -46
- package/kwlist.d.ts +16 -0
- package/kwlist.js +535 -0
- package/package.json +4 -3
- package/utils/quote-utils.d.ts +23 -2
- package/utils/quote-utils.js +77 -46
package/deparser.js
CHANGED
|
@@ -1191,12 +1191,12 @@ class Deparser {
|
|
|
1191
1191
|
ResTarget(node, context) {
|
|
1192
1192
|
const output = [];
|
|
1193
1193
|
if (context.update && node.name) {
|
|
1194
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
1194
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
1195
1195
|
// Handle indirection (array indexing, field access, etc.)
|
|
1196
1196
|
if (node.indirection && node.indirection.length > 0) {
|
|
1197
1197
|
const indirectionStrs = list_utils_1.ListUtils.unwrapList(node.indirection).map(item => {
|
|
1198
1198
|
if (item.String) {
|
|
1199
|
-
return `.${quote_utils_1.QuoteUtils.
|
|
1199
|
+
return `.${quote_utils_1.QuoteUtils.quoteIdentifier(item.String.sval || item.String.str)}`;
|
|
1200
1200
|
}
|
|
1201
1201
|
return this.visit(item, context);
|
|
1202
1202
|
});
|
|
@@ -1208,12 +1208,12 @@ class Deparser {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
1210
|
else if (context.insertColumns && node.name) {
|
|
1211
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
1211
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
1212
1212
|
// Handle indirection for INSERT column lists (e.g., q.c1.r)
|
|
1213
1213
|
if (node.indirection && node.indirection.length > 0) {
|
|
1214
1214
|
const indirectionStrs = list_utils_1.ListUtils.unwrapList(node.indirection).map(item => {
|
|
1215
1215
|
if (item.String) {
|
|
1216
|
-
return `.${quote_utils_1.QuoteUtils.
|
|
1216
|
+
return `.${quote_utils_1.QuoteUtils.quoteIdentifier(item.String.sval || item.String.str)}`;
|
|
1217
1217
|
}
|
|
1218
1218
|
return this.visit(item, context);
|
|
1219
1219
|
});
|
|
@@ -1226,7 +1226,7 @@ class Deparser {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
if (node.name) {
|
|
1228
1228
|
output.push('AS');
|
|
1229
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
1229
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
1232
|
return output.join(' ');
|
|
@@ -1240,7 +1240,7 @@ class Deparser {
|
|
|
1240
1240
|
if (this.getNodeType(item) === 'ResTarget') {
|
|
1241
1241
|
const resTarget = this.getNodeData(item);
|
|
1242
1242
|
const val = resTarget.val ? this.visit(resTarget.val, context) : '';
|
|
1243
|
-
const alias = resTarget.name ? ` AS ${quote_utils_1.QuoteUtils.
|
|
1243
|
+
const alias = resTarget.name ? ` AS ${quote_utils_1.QuoteUtils.quoteIdentifier(resTarget.name)}` : '';
|
|
1244
1244
|
return val + alias;
|
|
1245
1245
|
}
|
|
1246
1246
|
else {
|
|
@@ -1677,7 +1677,7 @@ class Deparser {
|
|
|
1677
1677
|
const fields = list_utils_1.ListUtils.unwrapList(node.fields);
|
|
1678
1678
|
return fields.map(field => {
|
|
1679
1679
|
if (field.String) {
|
|
1680
|
-
return quote_utils_1.QuoteUtils.
|
|
1680
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(field.String.sval || field.String.str);
|
|
1681
1681
|
}
|
|
1682
1682
|
else if (field.A_Star) {
|
|
1683
1683
|
return '*';
|
|
@@ -1754,8 +1754,7 @@ class Deparser {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
return output.join(' ');
|
|
1756
1756
|
}
|
|
1757
|
-
|
|
1758
|
-
let result = mods(quotedTypeName, args);
|
|
1757
|
+
let result = mods(typeName, args);
|
|
1759
1758
|
if (node.arrayBounds && node.arrayBounds.length > 0) {
|
|
1760
1759
|
result += formatArrayBounds(node.arrayBounds);
|
|
1761
1760
|
}
|
|
@@ -1851,7 +1850,7 @@ class Deparser {
|
|
|
1851
1850
|
return output.join(' ');
|
|
1852
1851
|
}
|
|
1853
1852
|
}
|
|
1854
|
-
const quotedNames = names.map((name) => quote_utils_1.QuoteUtils.
|
|
1853
|
+
const quotedNames = names.map((name) => quote_utils_1.QuoteUtils.quoteIdentifier(name));
|
|
1855
1854
|
let result = mods(quotedNames.join('.'), args);
|
|
1856
1855
|
if (node.arrayBounds && node.arrayBounds.length > 0) {
|
|
1857
1856
|
result += formatArrayBounds(node.arrayBounds);
|
|
@@ -1890,17 +1889,17 @@ class Deparser {
|
|
|
1890
1889
|
}
|
|
1891
1890
|
let tableName = '';
|
|
1892
1891
|
if (node.catalogname) {
|
|
1893
|
-
tableName = quote_utils_1.QuoteUtils.
|
|
1892
|
+
tableName = quote_utils_1.QuoteUtils.quoteIdentifier(node.catalogname);
|
|
1894
1893
|
if (node.schemaname) {
|
|
1895
|
-
tableName += '.' + quote_utils_1.QuoteUtils.
|
|
1894
|
+
tableName += '.' + quote_utils_1.QuoteUtils.quoteIdentifier(node.schemaname);
|
|
1896
1895
|
}
|
|
1897
|
-
tableName += '.' + quote_utils_1.QuoteUtils.
|
|
1896
|
+
tableName += '.' + quote_utils_1.QuoteUtils.quoteIdentifier(node.relname);
|
|
1898
1897
|
}
|
|
1899
1898
|
else if (node.schemaname) {
|
|
1900
|
-
tableName = quote_utils_1.QuoteUtils.
|
|
1899
|
+
tableName = quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(node.schemaname, node.relname);
|
|
1901
1900
|
}
|
|
1902
1901
|
else {
|
|
1903
|
-
tableName = quote_utils_1.QuoteUtils.
|
|
1902
|
+
tableName = quote_utils_1.QuoteUtils.quoteIdentifier(node.relname);
|
|
1904
1903
|
}
|
|
1905
1904
|
output.push(tableName);
|
|
1906
1905
|
if (node.alias) {
|
|
@@ -2126,7 +2125,7 @@ class Deparser {
|
|
|
2126
2125
|
const indirection = list_utils_1.ListUtils.unwrapList(node.indirection);
|
|
2127
2126
|
for (const subnode of indirection) {
|
|
2128
2127
|
if (subnode.String || subnode.A_Star) {
|
|
2129
|
-
const value = subnode.A_Star ? '*' : quote_utils_1.QuoteUtils.
|
|
2128
|
+
const value = subnode.A_Star ? '*' : quote_utils_1.QuoteUtils.quoteIdentifier(subnode.String.sval || subnode.String.str);
|
|
2130
2129
|
output.push(`.${value}`);
|
|
2131
2130
|
}
|
|
2132
2131
|
else {
|
|
@@ -2271,32 +2270,8 @@ class Deparser {
|
|
|
2271
2270
|
}
|
|
2272
2271
|
return output.join(' ');
|
|
2273
2272
|
}
|
|
2274
|
-
static RESERVED_WORDS = new Set([
|
|
2275
|
-
'all', 'analyse', 'analyze', 'and', 'any', 'array', 'as', 'asc', 'asymmetric', 'both',
|
|
2276
|
-
'case', 'cast', 'check', 'collate', 'column', 'constraint', 'create', 'current_catalog',
|
|
2277
|
-
'current_date', 'current_role', 'current_time', 'current_timestamp', 'current_user',
|
|
2278
|
-
'default', 'deferrable', 'desc', 'distinct', 'do', 'else', 'end', 'except', 'false',
|
|
2279
|
-
'fetch', 'for', 'foreign', 'from', 'grant', 'group', 'having', 'in', 'initially',
|
|
2280
|
-
'intersect', 'into', 'lateral', 'leading', 'limit', 'localtime', 'localtimestamp',
|
|
2281
|
-
'not', 'null', 'offset', 'on', 'only', 'or', 'order', 'placing', 'primary',
|
|
2282
|
-
'references', 'returning', 'select', 'session_user', 'some', 'symmetric', 'table',
|
|
2283
|
-
'then', 'to', 'trailing', 'true', 'union', 'unique', 'user', 'using', 'variadic',
|
|
2284
|
-
'when', 'where', 'window', 'with'
|
|
2285
|
-
]);
|
|
2286
|
-
static needsQuotes(value) {
|
|
2287
|
-
if (!value)
|
|
2288
|
-
return false;
|
|
2289
|
-
const needsQuotesRegex = /[a-z]+[\W\w]*[A-Z]+|[A-Z]+[\W\w]*[a-z]+|\W/;
|
|
2290
|
-
const isAllUppercase = /^[A-Z]+$/.test(value);
|
|
2291
|
-
return needsQuotesRegex.test(value) ||
|
|
2292
|
-
Deparser.RESERVED_WORDS.has(value.toLowerCase()) ||
|
|
2293
|
-
isAllUppercase;
|
|
2294
|
-
}
|
|
2295
2273
|
quoteIfNeeded(value) {
|
|
2296
|
-
|
|
2297
|
-
return `"${value}"`;
|
|
2298
|
-
}
|
|
2299
|
-
return value;
|
|
2274
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(value);
|
|
2300
2275
|
}
|
|
2301
2276
|
preserveOperatorDefElemCase(defName) {
|
|
2302
2277
|
const caseMap = {
|
|
@@ -2329,7 +2304,7 @@ class Deparser {
|
|
|
2329
2304
|
return value; // Don't quote pure operator symbols like "=" or "-"
|
|
2330
2305
|
}
|
|
2331
2306
|
}
|
|
2332
|
-
return
|
|
2307
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(value);
|
|
2333
2308
|
}
|
|
2334
2309
|
Integer(node, context) {
|
|
2335
2310
|
return node.ival?.toString() || '0';
|
|
@@ -2506,7 +2481,7 @@ class Deparser {
|
|
|
2506
2481
|
ColumnDef(node, context) {
|
|
2507
2482
|
const output = [];
|
|
2508
2483
|
if (node.colname) {
|
|
2509
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
2484
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.colname));
|
|
2510
2485
|
}
|
|
2511
2486
|
if (node.typeName) {
|
|
2512
2487
|
output.push(this.TypeName(node.typeName, context));
|
|
@@ -2547,7 +2522,7 @@ class Deparser {
|
|
|
2547
2522
|
// Handle constraint name if present
|
|
2548
2523
|
if (node.conname && (node.contype === 'CONSTR_CHECK' || node.contype === 'CONSTR_UNIQUE' || node.contype === 'CONSTR_PRIMARY' || node.contype === 'CONSTR_FOREIGN')) {
|
|
2549
2524
|
output.push('CONSTRAINT');
|
|
2550
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
2525
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.conname));
|
|
2551
2526
|
}
|
|
2552
2527
|
switch (node.contype) {
|
|
2553
2528
|
case 'CONSTR_NULL':
|
|
@@ -3444,7 +3419,7 @@ class Deparser {
|
|
|
3444
3419
|
output.push('IF NOT EXISTS');
|
|
3445
3420
|
}
|
|
3446
3421
|
if (node.idxname) {
|
|
3447
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
3422
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.idxname));
|
|
3448
3423
|
}
|
|
3449
3424
|
output.push('ON');
|
|
3450
3425
|
if (node.relation) {
|
|
@@ -3478,14 +3453,14 @@ class Deparser {
|
|
|
3478
3453
|
}
|
|
3479
3454
|
if (node.tableSpace) {
|
|
3480
3455
|
output.push('TABLESPACE');
|
|
3481
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
3456
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.tableSpace));
|
|
3482
3457
|
}
|
|
3483
3458
|
return output.join(' ');
|
|
3484
3459
|
}
|
|
3485
3460
|
IndexElem(node, context) {
|
|
3486
3461
|
const output = [];
|
|
3487
3462
|
if (node.name) {
|
|
3488
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
3463
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
3489
3464
|
}
|
|
3490
3465
|
else if (node.expr) {
|
|
3491
3466
|
output.push(context.parens(this.visit(node.expr, context)));
|
|
@@ -3536,7 +3511,7 @@ class Deparser {
|
|
|
3536
3511
|
PartitionElem(node, context) {
|
|
3537
3512
|
const output = [];
|
|
3538
3513
|
if (node.name) {
|
|
3539
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
3514
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
3540
3515
|
}
|
|
3541
3516
|
else if (node.expr) {
|
|
3542
3517
|
output.push(context.parens(this.visit(node.expr, context)));
|
|
@@ -3786,19 +3761,19 @@ class Deparser {
|
|
|
3786
3761
|
case 'TRANS_STMT_SAVEPOINT':
|
|
3787
3762
|
output.push('SAVEPOINT');
|
|
3788
3763
|
if (node.savepoint_name) {
|
|
3789
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
3764
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
|
|
3790
3765
|
}
|
|
3791
3766
|
break;
|
|
3792
3767
|
case 'TRANS_STMT_RELEASE':
|
|
3793
3768
|
output.push('RELEASE SAVEPOINT');
|
|
3794
3769
|
if (node.savepoint_name) {
|
|
3795
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
3770
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
|
|
3796
3771
|
}
|
|
3797
3772
|
break;
|
|
3798
3773
|
case 'TRANS_STMT_ROLLBACK_TO':
|
|
3799
3774
|
output.push('ROLLBACK TO');
|
|
3800
3775
|
if (node.savepoint_name) {
|
|
3801
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
3776
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
|
|
3802
3777
|
}
|
|
3803
3778
|
break;
|
|
3804
3779
|
case 'TRANS_STMT_PREPARE':
|
|
@@ -3895,16 +3870,16 @@ class Deparser {
|
|
|
3895
3870
|
return this.visit(arg, context);
|
|
3896
3871
|
}).join(', ') : '';
|
|
3897
3872
|
// Handle args - always include TO clause if args exist (even if empty string)
|
|
3898
|
-
const paramName =
|
|
3873
|
+
const paramName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
|
|
3899
3874
|
if (!node.args || node.args.length === 0) {
|
|
3900
3875
|
return `SET ${localPrefix}${paramName}`;
|
|
3901
3876
|
}
|
|
3902
3877
|
return `SET ${localPrefix}${paramName} TO ${args}`;
|
|
3903
3878
|
case 'VAR_SET_DEFAULT':
|
|
3904
|
-
const defaultParamName =
|
|
3879
|
+
const defaultParamName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
|
|
3905
3880
|
return `SET ${defaultParamName} TO DEFAULT`;
|
|
3906
3881
|
case 'VAR_SET_CURRENT':
|
|
3907
|
-
const currentParamName =
|
|
3882
|
+
const currentParamName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
|
|
3908
3883
|
return `SET ${currentParamName} FROM CURRENT`;
|
|
3909
3884
|
case 'VAR_SET_MULTI':
|
|
3910
3885
|
if (node.name === 'TRANSACTION' || node.name === 'SESSION CHARACTERISTICS') {
|
|
@@ -3978,7 +3953,7 @@ class Deparser {
|
|
|
3978
3953
|
return `SET ${assignments}`;
|
|
3979
3954
|
}
|
|
3980
3955
|
case 'VAR_RESET':
|
|
3981
|
-
const resetParamName =
|
|
3956
|
+
const resetParamName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
|
|
3982
3957
|
return `RESET ${resetParamName}`;
|
|
3983
3958
|
case 'VAR_RESET_ALL':
|
|
3984
3959
|
return 'RESET ALL';
|
|
@@ -4247,7 +4222,7 @@ class Deparser {
|
|
|
4247
4222
|
if (objList && objList.List && objList.List.items) {
|
|
4248
4223
|
const items = objList.List.items.map((item) => {
|
|
4249
4224
|
if (item.String && item.String.sval) {
|
|
4250
|
-
return quote_utils_1.QuoteUtils.
|
|
4225
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(item.String.sval);
|
|
4251
4226
|
}
|
|
4252
4227
|
return this.visit(item, context);
|
|
4253
4228
|
}).filter((name) => name && name.trim());
|
|
@@ -4281,13 +4256,13 @@ class Deparser {
|
|
|
4281
4256
|
if (items.length === 2) {
|
|
4282
4257
|
const accessMethod = items[0];
|
|
4283
4258
|
const objectName = items[1];
|
|
4284
|
-
return `${quote_utils_1.QuoteUtils.
|
|
4259
|
+
return `${quote_utils_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`;
|
|
4285
4260
|
}
|
|
4286
4261
|
else if (items.length === 3) {
|
|
4287
4262
|
const accessMethod = items[0];
|
|
4288
4263
|
const schemaName = items[1];
|
|
4289
4264
|
const objectName = items[2];
|
|
4290
|
-
return `${quote_utils_1.QuoteUtils.
|
|
4265
|
+
return `${quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, objectName)} USING ${accessMethod}`;
|
|
4291
4266
|
}
|
|
4292
4267
|
return items.join('.');
|
|
4293
4268
|
}
|
|
@@ -4330,7 +4305,7 @@ class Deparser {
|
|
|
4330
4305
|
if (objList && objList.List && objList.List.items) {
|
|
4331
4306
|
const items = objList.List.items.map((item) => {
|
|
4332
4307
|
if (item.String && item.String.sval) {
|
|
4333
|
-
return quote_utils_1.QuoteUtils.
|
|
4308
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(item.String.sval);
|
|
4334
4309
|
}
|
|
4335
4310
|
return this.visit(item, context);
|
|
4336
4311
|
}).filter((name) => name && name.trim());
|
|
@@ -4378,7 +4353,7 @@ class Deparser {
|
|
|
4378
4353
|
PLAssignStmt(node, context) {
|
|
4379
4354
|
const output = [];
|
|
4380
4355
|
if (node.name) {
|
|
4381
|
-
let nameWithIndirection = quote_utils_1.QuoteUtils.
|
|
4356
|
+
let nameWithIndirection = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
|
|
4382
4357
|
if (node.indirection && node.indirection.length > 0) {
|
|
4383
4358
|
const indirectionStr = node.indirection
|
|
4384
4359
|
.map((ind) => this.visit(ind, context))
|
|
@@ -4527,7 +4502,7 @@ class Deparser {
|
|
|
4527
4502
|
const parts = [];
|
|
4528
4503
|
const indentedParts = [];
|
|
4529
4504
|
if (colDefData.colname) {
|
|
4530
|
-
parts.push(quote_utils_1.QuoteUtils.
|
|
4505
|
+
parts.push(quote_utils_1.QuoteUtils.quoteIdentifier(colDefData.colname));
|
|
4531
4506
|
}
|
|
4532
4507
|
if (colDefData.typeName) {
|
|
4533
4508
|
parts.push(this.TypeName(colDefData.typeName, context));
|
|
@@ -4585,7 +4560,7 @@ class Deparser {
|
|
|
4585
4560
|
else {
|
|
4586
4561
|
const parts = [];
|
|
4587
4562
|
if (colDefData.colname) {
|
|
4588
|
-
parts.push(quote_utils_1.QuoteUtils.
|
|
4563
|
+
parts.push(quote_utils_1.QuoteUtils.quoteIdentifier(colDefData.colname));
|
|
4589
4564
|
}
|
|
4590
4565
|
if (colDefData.typeName) {
|
|
4591
4566
|
parts.push(this.TypeName(colDefData.typeName, context));
|
|
@@ -4639,7 +4614,7 @@ class Deparser {
|
|
|
4639
4614
|
}
|
|
4640
4615
|
}
|
|
4641
4616
|
if (node.name) {
|
|
4642
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4617
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4643
4618
|
}
|
|
4644
4619
|
if (node.behavior === 'DROP_CASCADE') {
|
|
4645
4620
|
output.push('CASCADE');
|
|
@@ -4656,7 +4631,7 @@ class Deparser {
|
|
|
4656
4631
|
output.push('ALTER COLUMN');
|
|
4657
4632
|
}
|
|
4658
4633
|
if (node.name) {
|
|
4659
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4634
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4660
4635
|
}
|
|
4661
4636
|
output.push('TYPE');
|
|
4662
4637
|
if (node.def) {
|
|
@@ -4683,7 +4658,7 @@ class Deparser {
|
|
|
4683
4658
|
case 'AT_SetTableSpace':
|
|
4684
4659
|
output.push('SET TABLESPACE');
|
|
4685
4660
|
if (node.name) {
|
|
4686
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4661
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4687
4662
|
}
|
|
4688
4663
|
break;
|
|
4689
4664
|
case 'AT_AddConstraint':
|
|
@@ -4701,7 +4676,7 @@ class Deparser {
|
|
|
4701
4676
|
output.push('DROP CONSTRAINT');
|
|
4702
4677
|
}
|
|
4703
4678
|
if (node.name) {
|
|
4704
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4679
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4705
4680
|
}
|
|
4706
4681
|
if (node.behavior === 'DROP_CASCADE') {
|
|
4707
4682
|
output.push('CASCADE');
|
|
@@ -4739,7 +4714,7 @@ class Deparser {
|
|
|
4739
4714
|
case 'AT_ColumnDefault':
|
|
4740
4715
|
output.push('ALTER COLUMN');
|
|
4741
4716
|
if (node.name) {
|
|
4742
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4717
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4743
4718
|
}
|
|
4744
4719
|
if (node.def) {
|
|
4745
4720
|
output.push('SET DEFAULT');
|
|
@@ -4752,7 +4727,7 @@ class Deparser {
|
|
|
4752
4727
|
case 'AT_SetStorage':
|
|
4753
4728
|
output.push('ALTER COLUMN');
|
|
4754
4729
|
if (node.name) {
|
|
4755
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4730
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4756
4731
|
}
|
|
4757
4732
|
output.push('SET STORAGE');
|
|
4758
4733
|
if (node.def) {
|
|
@@ -4763,7 +4738,7 @@ class Deparser {
|
|
|
4763
4738
|
case 'AT_ClusterOn':
|
|
4764
4739
|
output.push('CLUSTER ON');
|
|
4765
4740
|
if (node.name) {
|
|
4766
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4741
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4767
4742
|
}
|
|
4768
4743
|
break;
|
|
4769
4744
|
case 'AT_DropCluster':
|
|
@@ -4790,21 +4765,21 @@ class Deparser {
|
|
|
4790
4765
|
case 'AT_SetNotNull':
|
|
4791
4766
|
output.push('ALTER COLUMN');
|
|
4792
4767
|
if (node.name) {
|
|
4793
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4768
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4794
4769
|
}
|
|
4795
4770
|
output.push('SET NOT NULL');
|
|
4796
4771
|
break;
|
|
4797
4772
|
case 'AT_DropNotNull':
|
|
4798
4773
|
output.push('ALTER COLUMN');
|
|
4799
4774
|
if (node.name) {
|
|
4800
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4775
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4801
4776
|
}
|
|
4802
4777
|
output.push('DROP NOT NULL');
|
|
4803
4778
|
break;
|
|
4804
4779
|
case 'AT_SetStatistics':
|
|
4805
4780
|
output.push('ALTER COLUMN');
|
|
4806
4781
|
if (node.name) {
|
|
4807
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4782
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4808
4783
|
}
|
|
4809
4784
|
else if (node.num !== undefined && node.num !== null) {
|
|
4810
4785
|
output.push(node.num.toString());
|
|
@@ -4817,7 +4792,7 @@ class Deparser {
|
|
|
4817
4792
|
case 'AT_SetOptions':
|
|
4818
4793
|
output.push('ALTER COLUMN');
|
|
4819
4794
|
if (node.name) {
|
|
4820
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4795
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4821
4796
|
}
|
|
4822
4797
|
output.push('SET');
|
|
4823
4798
|
if (node.def) {
|
|
@@ -4834,7 +4809,7 @@ class Deparser {
|
|
|
4834
4809
|
case 'AT_ResetOptions':
|
|
4835
4810
|
output.push('ALTER COLUMN');
|
|
4836
4811
|
if (node.name) {
|
|
4837
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4812
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4838
4813
|
}
|
|
4839
4814
|
output.push('RESET');
|
|
4840
4815
|
if (node.def) {
|
|
@@ -4851,7 +4826,7 @@ class Deparser {
|
|
|
4851
4826
|
case 'AT_SetCompression':
|
|
4852
4827
|
output.push('ALTER COLUMN');
|
|
4853
4828
|
if (node.name) {
|
|
4854
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4829
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4855
4830
|
}
|
|
4856
4831
|
output.push('SET COMPRESSION');
|
|
4857
4832
|
if (node.def) {
|
|
@@ -4861,31 +4836,31 @@ class Deparser {
|
|
|
4861
4836
|
case 'AT_ValidateConstraint':
|
|
4862
4837
|
output.push('VALIDATE CONSTRAINT');
|
|
4863
4838
|
if (node.name) {
|
|
4864
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4839
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4865
4840
|
}
|
|
4866
4841
|
break;
|
|
4867
4842
|
case 'AT_EnableTrig':
|
|
4868
4843
|
output.push('ENABLE TRIGGER');
|
|
4869
4844
|
if (node.name) {
|
|
4870
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4845
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4871
4846
|
}
|
|
4872
4847
|
break;
|
|
4873
4848
|
case 'AT_EnableAlwaysTrig':
|
|
4874
4849
|
output.push('ENABLE ALWAYS TRIGGER');
|
|
4875
4850
|
if (node.name) {
|
|
4876
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4851
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4877
4852
|
}
|
|
4878
4853
|
break;
|
|
4879
4854
|
case 'AT_EnableReplicaTrig':
|
|
4880
4855
|
output.push('ENABLE REPLICA TRIGGER');
|
|
4881
4856
|
if (node.name) {
|
|
4882
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4857
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4883
4858
|
}
|
|
4884
4859
|
break;
|
|
4885
4860
|
case 'AT_DisableTrig':
|
|
4886
4861
|
output.push('DISABLE TRIGGER');
|
|
4887
4862
|
if (node.name) {
|
|
4888
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4863
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4889
4864
|
}
|
|
4890
4865
|
break;
|
|
4891
4866
|
case 'AT_EnableTrigAll':
|
|
@@ -4903,31 +4878,31 @@ class Deparser {
|
|
|
4903
4878
|
case 'AT_EnableRule':
|
|
4904
4879
|
output.push('ENABLE RULE');
|
|
4905
4880
|
if (node.name) {
|
|
4906
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4881
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4907
4882
|
}
|
|
4908
4883
|
break;
|
|
4909
4884
|
case 'AT_EnableAlwaysRule':
|
|
4910
4885
|
output.push('ENABLE ALWAYS RULE');
|
|
4911
4886
|
if (node.name) {
|
|
4912
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4887
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4913
4888
|
}
|
|
4914
4889
|
break;
|
|
4915
4890
|
case 'AT_EnableReplicaRule':
|
|
4916
4891
|
output.push('ENABLE REPLICA RULE');
|
|
4917
4892
|
if (node.name) {
|
|
4918
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4893
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4919
4894
|
}
|
|
4920
4895
|
break;
|
|
4921
4896
|
case 'AT_DisableRule':
|
|
4922
4897
|
output.push('DISABLE RULE');
|
|
4923
4898
|
if (node.name) {
|
|
4924
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4899
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4925
4900
|
}
|
|
4926
4901
|
break;
|
|
4927
4902
|
case 'AT_SetAccessMethod':
|
|
4928
4903
|
output.push('SET ACCESS METHOD');
|
|
4929
4904
|
if (node.name) {
|
|
4930
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4905
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4931
4906
|
}
|
|
4932
4907
|
else {
|
|
4933
4908
|
// Handle DEFAULT access method case
|
|
@@ -4981,7 +4956,7 @@ class Deparser {
|
|
|
4981
4956
|
case 'AT_CookedColumnDefault':
|
|
4982
4957
|
output.push('ALTER COLUMN');
|
|
4983
4958
|
if (node.name) {
|
|
4984
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4959
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4985
4960
|
}
|
|
4986
4961
|
if (node.def) {
|
|
4987
4962
|
output.push('SET DEFAULT');
|
|
@@ -4994,7 +4969,7 @@ class Deparser {
|
|
|
4994
4969
|
case 'AT_SetExpression':
|
|
4995
4970
|
output.push('ALTER COLUMN');
|
|
4996
4971
|
if (node.name) {
|
|
4997
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4972
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
4998
4973
|
}
|
|
4999
4974
|
output.push('SET EXPRESSION');
|
|
5000
4975
|
if (node.def) {
|
|
@@ -5004,14 +4979,14 @@ class Deparser {
|
|
|
5004
4979
|
case 'AT_DropExpression':
|
|
5005
4980
|
output.push('ALTER COLUMN');
|
|
5006
4981
|
if (node.name) {
|
|
5007
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4982
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
5008
4983
|
}
|
|
5009
4984
|
output.push('DROP EXPRESSION');
|
|
5010
4985
|
break;
|
|
5011
4986
|
case 'AT_CheckNotNull':
|
|
5012
4987
|
output.push('ALTER COLUMN');
|
|
5013
4988
|
if (node.name) {
|
|
5014
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
4989
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
5015
4990
|
}
|
|
5016
4991
|
output.push('SET NOT NULL');
|
|
5017
4992
|
break;
|
|
@@ -5044,7 +5019,7 @@ class Deparser {
|
|
|
5044
5019
|
if (node.def && this.getNodeType(node.def) === 'Constraint') {
|
|
5045
5020
|
const constraintData = this.getNodeData(node.def);
|
|
5046
5021
|
if (constraintData.conname) {
|
|
5047
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
5022
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(constraintData.conname));
|
|
5048
5023
|
if (constraintData.deferrable !== undefined) {
|
|
5049
5024
|
output.push(constraintData.deferrable ? 'DEFERRABLE' : 'NOT DEFERRABLE');
|
|
5050
5025
|
}
|
|
@@ -5054,7 +5029,7 @@ class Deparser {
|
|
|
5054
5029
|
}
|
|
5055
5030
|
}
|
|
5056
5031
|
else if (node.name) {
|
|
5057
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
5032
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
5058
5033
|
if (node.def) {
|
|
5059
5034
|
output.push(this.visit(node.def, context));
|
|
5060
5035
|
}
|
|
@@ -5075,7 +5050,7 @@ class Deparser {
|
|
|
5075
5050
|
case 'AT_AlterColumnGenericOptions':
|
|
5076
5051
|
output.push('ALTER COLUMN');
|
|
5077
5052
|
if (node.name) {
|
|
5078
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
5053
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
5079
5054
|
}
|
|
5080
5055
|
output.push('OPTIONS');
|
|
5081
5056
|
if (node.def) {
|
|
@@ -5129,7 +5104,7 @@ class Deparser {
|
|
|
5129
5104
|
case 'AT_AddIdentity':
|
|
5130
5105
|
output.push('ALTER COLUMN');
|
|
5131
5106
|
if (node.name) {
|
|
5132
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
5107
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
5133
5108
|
}
|
|
5134
5109
|
output.push('ADD');
|
|
5135
5110
|
if (node.def) {
|
|
@@ -5139,7 +5114,7 @@ class Deparser {
|
|
|
5139
5114
|
case 'AT_SetIdentity':
|
|
5140
5115
|
output.push('ALTER COLUMN');
|
|
5141
5116
|
if (node.name) {
|
|
5142
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
5117
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
5143
5118
|
}
|
|
5144
5119
|
output.push('SET');
|
|
5145
5120
|
if (node.def) {
|
|
@@ -5149,7 +5124,7 @@ class Deparser {
|
|
|
5149
5124
|
case 'AT_DropIdentity':
|
|
5150
5125
|
output.push('ALTER COLUMN');
|
|
5151
5126
|
if (node.name) {
|
|
5152
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
5127
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
5153
5128
|
}
|
|
5154
5129
|
output.push('DROP IDENTITY');
|
|
5155
5130
|
if (node.behavior === 'DROP_CASCADE') {
|
|
@@ -5288,7 +5263,7 @@ class Deparser {
|
|
|
5288
5263
|
}
|
|
5289
5264
|
}
|
|
5290
5265
|
if (node.name) {
|
|
5291
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
5266
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
5292
5267
|
}
|
|
5293
5268
|
if (node.argType) {
|
|
5294
5269
|
output.push(this.TypeName(node.argType, context));
|
|
@@ -5360,7 +5335,7 @@ class Deparser {
|
|
|
5360
5335
|
output.push('ROLE');
|
|
5361
5336
|
}
|
|
5362
5337
|
if (node.role) {
|
|
5363
|
-
const roleName =
|
|
5338
|
+
const roleName = quote_utils_1.QuoteUtils.quoteIdentifier(node.role);
|
|
5364
5339
|
output.push(roleName);
|
|
5365
5340
|
}
|
|
5366
5341
|
if (node.options) {
|
|
@@ -5402,7 +5377,7 @@ class Deparser {
|
|
|
5402
5377
|
if (context.parentNodeTypes.includes('DefineStmt') &&
|
|
5403
5378
|
['hashes', 'merges'].includes(node.defname.toLowerCase()) && !node.arg) {
|
|
5404
5379
|
if (node.defname !== node.defname.toLowerCase() && node.defname !== node.defname.toUpperCase()) {
|
|
5405
|
-
return
|
|
5380
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
|
|
5406
5381
|
}
|
|
5407
5382
|
return node.defname.charAt(0).toUpperCase() + node.defname.slice(1).toLowerCase();
|
|
5408
5383
|
}
|
|
@@ -5424,9 +5399,7 @@ class Deparser {
|
|
|
5424
5399
|
const finalValue = typeof argValue === 'string' && !argValue.startsWith("'")
|
|
5425
5400
|
? `'${argValue}'`
|
|
5426
5401
|
: argValue;
|
|
5427
|
-
const quotedDefname =
|
|
5428
|
-
? `"${node.defname}"`
|
|
5429
|
-
: node.defname;
|
|
5402
|
+
const quotedDefname = quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
|
|
5430
5403
|
if (node.defaction === 'DEFELEM_ADD') {
|
|
5431
5404
|
return `ADD ${quotedDefname} ${finalValue}`;
|
|
5432
5405
|
}
|
|
@@ -5450,9 +5423,7 @@ class Deparser {
|
|
|
5450
5423
|
else if (node.defaction === 'DEFELEM_SET') {
|
|
5451
5424
|
return `SET ${node.defname} ${quotedValue}`;
|
|
5452
5425
|
}
|
|
5453
|
-
const quotedDefname =
|
|
5454
|
-
? `"${node.defname}"`
|
|
5455
|
-
: node.defname;
|
|
5426
|
+
const quotedDefname = quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
|
|
5456
5427
|
return `${quotedDefname} ${quotedValue}`;
|
|
5457
5428
|
}
|
|
5458
5429
|
else if (node.defaction === 'DEFELEM_DROP') {
|
|
@@ -5512,9 +5483,7 @@ class Deparser {
|
|
|
5512
5483
|
const quotedValue = typeof argValue === 'string'
|
|
5513
5484
|
? quote_utils_1.QuoteUtils.escape(argValue)
|
|
5514
5485
|
: argValue;
|
|
5515
|
-
const quotedDefname =
|
|
5516
|
-
? `"${node.defname}"`
|
|
5517
|
-
: node.defname;
|
|
5486
|
+
const quotedDefname = quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
|
|
5518
5487
|
return `${quotedDefname} ${quotedValue}`;
|
|
5519
5488
|
}
|
|
5520
5489
|
if (context.parentNodeTypes.includes('CreateRoleStmt') || context.parentNodeTypes.includes('AlterRoleStmt')) {
|
|
@@ -5589,10 +5558,7 @@ class Deparser {
|
|
|
5589
5558
|
if (this.getNodeType(item) === 'String') {
|
|
5590
5559
|
// Check if this identifier needs quotes to preserve case
|
|
5591
5560
|
const value = itemData.sval;
|
|
5592
|
-
|
|
5593
|
-
return `"${value}"`;
|
|
5594
|
-
}
|
|
5595
|
-
return value;
|
|
5561
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(value);
|
|
5596
5562
|
}
|
|
5597
5563
|
return this.visit(item, context);
|
|
5598
5564
|
});
|
|
@@ -5840,13 +5806,13 @@ class Deparser {
|
|
|
5840
5806
|
// Handle boolean flags (no arguments) - preserve quoted case
|
|
5841
5807
|
if (['hashes', 'merges'].includes(node.defname.toLowerCase())) {
|
|
5842
5808
|
if (node.defname !== node.defname.toLowerCase() && node.defname !== node.defname.toUpperCase()) {
|
|
5843
|
-
return
|
|
5809
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
|
|
5844
5810
|
}
|
|
5845
5811
|
return preservedName.toUpperCase();
|
|
5846
5812
|
}
|
|
5847
5813
|
// Handle CREATE AGGREGATE quoted identifiers - preserve quotes when needed
|
|
5848
|
-
|
|
5849
|
-
|
|
5814
|
+
const quotedDefname = quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
|
|
5815
|
+
if (quotedDefname !== node.defname) {
|
|
5850
5816
|
if (node.arg) {
|
|
5851
5817
|
if (this.getNodeType(node.arg) === 'String') {
|
|
5852
5818
|
const stringData = this.getNodeData(node.arg);
|
|
@@ -5906,7 +5872,7 @@ class Deparser {
|
|
|
5906
5872
|
if (context.parentNodeTypes.includes('DefineStmt') && !node.arg) {
|
|
5907
5873
|
// Check if the original defname appears to be quoted (mixed case that's not all upper/lower)
|
|
5908
5874
|
if (node.defname !== node.defname.toLowerCase() && node.defname !== node.defname.toUpperCase()) {
|
|
5909
|
-
return
|
|
5875
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
|
|
5910
5876
|
}
|
|
5911
5877
|
}
|
|
5912
5878
|
return node.defname.toUpperCase();
|
|
@@ -6090,7 +6056,7 @@ class Deparser {
|
|
|
6090
6056
|
case 'REPLICA_IDENTITY_INDEX':
|
|
6091
6057
|
output.push('USING', 'INDEX');
|
|
6092
6058
|
if (node.name) {
|
|
6093
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
6059
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
6094
6060
|
}
|
|
6095
6061
|
break;
|
|
6096
6062
|
default:
|
|
@@ -6149,7 +6115,7 @@ class Deparser {
|
|
|
6149
6115
|
output.push('IF', 'EXISTS');
|
|
6150
6116
|
}
|
|
6151
6117
|
if (node.name) {
|
|
6152
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
6118
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
6153
6119
|
}
|
|
6154
6120
|
if (node.behavior === 'DROP_CASCADE') {
|
|
6155
6121
|
output.push('CASCADE');
|
|
@@ -6158,7 +6124,7 @@ class Deparser {
|
|
|
6158
6124
|
case 'AT_ValidateConstraint':
|
|
6159
6125
|
output.push('VALIDATE', 'CONSTRAINT');
|
|
6160
6126
|
if (node.name) {
|
|
6161
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
6127
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
6162
6128
|
}
|
|
6163
6129
|
break;
|
|
6164
6130
|
case 'C':
|
|
@@ -6175,7 +6141,7 @@ class Deparser {
|
|
|
6175
6141
|
output.push('IF', 'EXISTS');
|
|
6176
6142
|
}
|
|
6177
6143
|
if (node.name) {
|
|
6178
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
6144
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
6179
6145
|
}
|
|
6180
6146
|
if (node.behavior === 'DROP_CASCADE') {
|
|
6181
6147
|
output.push('CASCADE');
|
|
@@ -6184,7 +6150,7 @@ class Deparser {
|
|
|
6184
6150
|
case 'V':
|
|
6185
6151
|
output.push('VALIDATE', 'CONSTRAINT');
|
|
6186
6152
|
if (node.name) {
|
|
6187
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
6153
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
6188
6154
|
}
|
|
6189
6155
|
break;
|
|
6190
6156
|
case 'O':
|
|
@@ -6573,7 +6539,7 @@ class Deparser {
|
|
|
6573
6539
|
const output = [];
|
|
6574
6540
|
const initialParts = ['CREATE', 'POLICY'];
|
|
6575
6541
|
if (node.policy_name) {
|
|
6576
|
-
initialParts.push(quote_utils_1.QuoteUtils.
|
|
6542
|
+
initialParts.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.policy_name));
|
|
6577
6543
|
}
|
|
6578
6544
|
output.push(initialParts.join(' '));
|
|
6579
6545
|
// Add ON clause on new line in pretty mode
|
|
@@ -6650,7 +6616,7 @@ class Deparser {
|
|
|
6650
6616
|
AlterPolicyStmt(node, context) {
|
|
6651
6617
|
const output = ['ALTER', 'POLICY'];
|
|
6652
6618
|
if (node.policy_name) {
|
|
6653
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
6619
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.policy_name));
|
|
6654
6620
|
}
|
|
6655
6621
|
if (node.table) {
|
|
6656
6622
|
output.push('ON');
|
|
@@ -6686,7 +6652,7 @@ class Deparser {
|
|
|
6686
6652
|
}
|
|
6687
6653
|
output.push('SERVER');
|
|
6688
6654
|
if (node.servername) {
|
|
6689
|
-
output.push(
|
|
6655
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
|
|
6690
6656
|
}
|
|
6691
6657
|
if (node.options && node.options.length > 0) {
|
|
6692
6658
|
output.push('OPTIONS');
|
|
@@ -6734,7 +6700,7 @@ class Deparser {
|
|
|
6734
6700
|
CreatePublicationStmt(node, context) {
|
|
6735
6701
|
const output = ['CREATE', 'PUBLICATION'];
|
|
6736
6702
|
if (node.pubname) {
|
|
6737
|
-
output.push(
|
|
6703
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.pubname));
|
|
6738
6704
|
}
|
|
6739
6705
|
if (node.pubobjects && node.pubobjects.length > 0) {
|
|
6740
6706
|
output.push('FOR', 'TABLE');
|
|
@@ -6754,7 +6720,7 @@ class Deparser {
|
|
|
6754
6720
|
CreateSubscriptionStmt(node, context) {
|
|
6755
6721
|
const output = ['CREATE', 'SUBSCRIPTION'];
|
|
6756
6722
|
if (node.subname) {
|
|
6757
|
-
output.push(
|
|
6723
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
|
|
6758
6724
|
}
|
|
6759
6725
|
output.push('CONNECTION');
|
|
6760
6726
|
if (node.conninfo) {
|
|
@@ -6775,7 +6741,7 @@ class Deparser {
|
|
|
6775
6741
|
AlterPublicationStmt(node, context) {
|
|
6776
6742
|
const output = ['ALTER', 'PUBLICATION'];
|
|
6777
6743
|
if (node.pubname) {
|
|
6778
|
-
output.push(
|
|
6744
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.pubname));
|
|
6779
6745
|
}
|
|
6780
6746
|
if (node.action) {
|
|
6781
6747
|
switch (node.action) {
|
|
@@ -6810,7 +6776,7 @@ class Deparser {
|
|
|
6810
6776
|
AlterSubscriptionStmt(node, context) {
|
|
6811
6777
|
const output = ['ALTER', 'SUBSCRIPTION'];
|
|
6812
6778
|
if (node.subname) {
|
|
6813
|
-
output.push(
|
|
6779
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
|
|
6814
6780
|
}
|
|
6815
6781
|
if (node.kind) {
|
|
6816
6782
|
switch (node.kind) {
|
|
@@ -6856,7 +6822,7 @@ class Deparser {
|
|
|
6856
6822
|
output.push('IF EXISTS');
|
|
6857
6823
|
}
|
|
6858
6824
|
if (node.subname) {
|
|
6859
|
-
output.push(
|
|
6825
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
|
|
6860
6826
|
}
|
|
6861
6827
|
if (node.behavior) {
|
|
6862
6828
|
switch (node.behavior) {
|
|
@@ -7101,7 +7067,7 @@ class Deparser {
|
|
|
7101
7067
|
ClosePortalStmt(node, context) {
|
|
7102
7068
|
const output = ['CLOSE'];
|
|
7103
7069
|
if (node.portalname) {
|
|
7104
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7070
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.portalname));
|
|
7105
7071
|
}
|
|
7106
7072
|
else {
|
|
7107
7073
|
output.push('ALL');
|
|
@@ -7159,7 +7125,7 @@ class Deparser {
|
|
|
7159
7125
|
output.push('ALL');
|
|
7160
7126
|
}
|
|
7161
7127
|
if (node.portalname) {
|
|
7162
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7128
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.portalname));
|
|
7163
7129
|
}
|
|
7164
7130
|
return output.join(' ');
|
|
7165
7131
|
}
|
|
@@ -7229,7 +7195,7 @@ class Deparser {
|
|
|
7229
7195
|
AlterFdwStmt(node, context) {
|
|
7230
7196
|
const output = ['ALTER', 'FOREIGN', 'DATA', 'WRAPPER'];
|
|
7231
7197
|
if (node.fdwname) {
|
|
7232
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7198
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.fdwname));
|
|
7233
7199
|
}
|
|
7234
7200
|
if (node.func_options && node.func_options.length > 0) {
|
|
7235
7201
|
const fdwContext = context.spawn('AlterFdwStmt');
|
|
@@ -7250,7 +7216,7 @@ class Deparser {
|
|
|
7250
7216
|
output.push('IF', 'NOT', 'EXISTS');
|
|
7251
7217
|
}
|
|
7252
7218
|
if (node.servername) {
|
|
7253
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7219
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
|
|
7254
7220
|
}
|
|
7255
7221
|
if (node.servertype) {
|
|
7256
7222
|
output.push('TYPE', quote_utils_1.QuoteUtils.escape(node.servertype));
|
|
@@ -7259,7 +7225,7 @@ class Deparser {
|
|
|
7259
7225
|
output.push('VERSION', quote_utils_1.QuoteUtils.escape(node.version));
|
|
7260
7226
|
}
|
|
7261
7227
|
if (node.fdwname) {
|
|
7262
|
-
output.push('FOREIGN', 'DATA', 'WRAPPER', quote_utils_1.QuoteUtils.
|
|
7228
|
+
output.push('FOREIGN', 'DATA', 'WRAPPER', quote_utils_1.QuoteUtils.quoteIdentifier(node.fdwname));
|
|
7263
7229
|
}
|
|
7264
7230
|
if (node.options && node.options.length > 0) {
|
|
7265
7231
|
output.push('OPTIONS');
|
|
@@ -7274,7 +7240,7 @@ class Deparser {
|
|
|
7274
7240
|
AlterForeignServerStmt(node, context) {
|
|
7275
7241
|
const output = ['ALTER', 'SERVER'];
|
|
7276
7242
|
if (node.servername) {
|
|
7277
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7243
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
|
|
7278
7244
|
}
|
|
7279
7245
|
if (node.version) {
|
|
7280
7246
|
output.push('VERSION', quote_utils_1.QuoteUtils.escape(node.version));
|
|
@@ -7299,7 +7265,7 @@ class Deparser {
|
|
|
7299
7265
|
}
|
|
7300
7266
|
output.push('SERVER');
|
|
7301
7267
|
if (node.servername) {
|
|
7302
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7268
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
|
|
7303
7269
|
}
|
|
7304
7270
|
if (node.options && node.options.length > 0) {
|
|
7305
7271
|
output.push('OPTIONS');
|
|
@@ -7323,14 +7289,14 @@ class Deparser {
|
|
|
7323
7289
|
}
|
|
7324
7290
|
output.push('SERVER');
|
|
7325
7291
|
if (node.servername) {
|
|
7326
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7292
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
|
|
7327
7293
|
}
|
|
7328
7294
|
return output.join(' ');
|
|
7329
7295
|
}
|
|
7330
7296
|
ImportForeignSchemaStmt(node, context) {
|
|
7331
7297
|
const output = ['IMPORT', 'FOREIGN', 'SCHEMA'];
|
|
7332
7298
|
if (node.remote_schema) {
|
|
7333
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7299
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.remote_schema));
|
|
7334
7300
|
}
|
|
7335
7301
|
if (node.list_type) {
|
|
7336
7302
|
switch (node.list_type) {
|
|
@@ -7356,11 +7322,11 @@ class Deparser {
|
|
|
7356
7322
|
}
|
|
7357
7323
|
output.push('FROM', 'SERVER');
|
|
7358
7324
|
if (node.server_name) {
|
|
7359
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7325
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.server_name));
|
|
7360
7326
|
}
|
|
7361
7327
|
output.push('INTO');
|
|
7362
7328
|
if (node.local_schema) {
|
|
7363
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7329
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.local_schema));
|
|
7364
7330
|
}
|
|
7365
7331
|
if (node.options && node.options.length > 0) {
|
|
7366
7332
|
const importSchemaContext = context.spawn('ImportForeignSchemaStmt');
|
|
@@ -7374,7 +7340,7 @@ class Deparser {
|
|
|
7374
7340
|
if (node.relation) {
|
|
7375
7341
|
output.push(this.RangeVar(node.relation, context));
|
|
7376
7342
|
if (node.indexname) {
|
|
7377
|
-
output.push('USING',
|
|
7343
|
+
output.push('USING', quote_utils_1.QuoteUtils.quoteIdentifier(node.indexname));
|
|
7378
7344
|
}
|
|
7379
7345
|
}
|
|
7380
7346
|
if (node.params && node.params.length > 0) {
|
|
@@ -7438,7 +7404,7 @@ class Deparser {
|
|
|
7438
7404
|
output.push(this.RangeVar(node.relation, context));
|
|
7439
7405
|
}
|
|
7440
7406
|
if (node.name) {
|
|
7441
|
-
output.push(
|
|
7407
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
7442
7408
|
}
|
|
7443
7409
|
return output.join(' ');
|
|
7444
7410
|
}
|
|
@@ -7478,7 +7444,7 @@ class Deparser {
|
|
|
7478
7444
|
if (!node.dbname) {
|
|
7479
7445
|
throw new Error('CreatedbStmt requires dbname');
|
|
7480
7446
|
}
|
|
7481
|
-
output.push(
|
|
7447
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
|
|
7482
7448
|
if (node.options && node.options.length > 0) {
|
|
7483
7449
|
const options = list_utils_1.ListUtils.unwrapList(node.options)
|
|
7484
7450
|
.map(option => this.visit(option, context))
|
|
@@ -7495,7 +7461,7 @@ class Deparser {
|
|
|
7495
7461
|
if (!node.dbname) {
|
|
7496
7462
|
throw new Error('DropdbStmt requires dbname');
|
|
7497
7463
|
}
|
|
7498
|
-
output.push(
|
|
7464
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
|
|
7499
7465
|
if (node.options && node.options.length > 0) {
|
|
7500
7466
|
const options = list_utils_1.ListUtils.unwrapList(node.options)
|
|
7501
7467
|
.map(option => this.visit(option, context))
|
|
@@ -7593,7 +7559,7 @@ class Deparser {
|
|
|
7593
7559
|
case 'OBJECT_POLICY':
|
|
7594
7560
|
output.push('POLICY');
|
|
7595
7561
|
if (node.subname) {
|
|
7596
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7562
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
|
|
7597
7563
|
}
|
|
7598
7564
|
break;
|
|
7599
7565
|
case 'OBJECT_PUBLICATION':
|
|
@@ -7651,7 +7617,7 @@ class Deparser {
|
|
|
7651
7617
|
}
|
|
7652
7618
|
// Handle OBJECT_RULE special case: rule_name ON table_name format
|
|
7653
7619
|
if (node.renameType === 'OBJECT_RULE' && node.subname && node.relation) {
|
|
7654
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7620
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
|
|
7655
7621
|
output.push('ON');
|
|
7656
7622
|
output.push(this.RangeVar(node.relation, context));
|
|
7657
7623
|
}
|
|
@@ -7670,7 +7636,7 @@ class Deparser {
|
|
|
7670
7636
|
if (items.length === 2) {
|
|
7671
7637
|
const accessMethod = items[0].String?.sval || '';
|
|
7672
7638
|
const objectName = items[1].String?.sval || '';
|
|
7673
|
-
output.push(`${quote_utils_1.QuoteUtils.
|
|
7639
|
+
output.push(`${quote_utils_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`);
|
|
7674
7640
|
}
|
|
7675
7641
|
else {
|
|
7676
7642
|
output.push(this.visit(node.object, context));
|
|
@@ -7691,19 +7657,19 @@ class Deparser {
|
|
|
7691
7657
|
}
|
|
7692
7658
|
}
|
|
7693
7659
|
if (node.renameType === 'OBJECT_COLUMN' && node.subname) {
|
|
7694
|
-
output.push('RENAME COLUMN',
|
|
7660
|
+
output.push('RENAME COLUMN', quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
|
|
7695
7661
|
}
|
|
7696
7662
|
else if (node.renameType === 'OBJECT_DOMCONSTRAINT' && node.subname) {
|
|
7697
|
-
output.push('RENAME CONSTRAINT',
|
|
7663
|
+
output.push('RENAME CONSTRAINT', quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
|
|
7698
7664
|
}
|
|
7699
7665
|
else if (node.renameType === 'OBJECT_TABCONSTRAINT' && node.subname) {
|
|
7700
|
-
output.push('RENAME CONSTRAINT',
|
|
7666
|
+
output.push('RENAME CONSTRAINT', quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
|
|
7701
7667
|
}
|
|
7702
7668
|
else if (node.renameType === 'OBJECT_ATTRIBUTE' && node.subname) {
|
|
7703
|
-
output.push('RENAME ATTRIBUTE',
|
|
7669
|
+
output.push('RENAME ATTRIBUTE', quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
|
|
7704
7670
|
}
|
|
7705
7671
|
else if (node.renameType === 'OBJECT_ROLE' && node.subname) {
|
|
7706
|
-
output.push(
|
|
7672
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'RENAME TO');
|
|
7707
7673
|
}
|
|
7708
7674
|
else if (node.renameType === 'OBJECT_SCHEMA' && node.subname) {
|
|
7709
7675
|
output.push(this.quoteIfNeeded(node.subname), 'RENAME TO');
|
|
@@ -7717,7 +7683,7 @@ class Deparser {
|
|
|
7717
7683
|
if (!node.newname) {
|
|
7718
7684
|
throw new Error('RenameStmt requires newname');
|
|
7719
7685
|
}
|
|
7720
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
7686
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.newname));
|
|
7721
7687
|
// Handle CASCADE/RESTRICT behavior for RENAME operations
|
|
7722
7688
|
if (node.behavior === 'DROP_CASCADE') {
|
|
7723
7689
|
output.push('CASCADE');
|
|
@@ -7740,7 +7706,7 @@ class Deparser {
|
|
|
7740
7706
|
if (items.length === 2) {
|
|
7741
7707
|
const accessMethod = items[0].String?.sval || '';
|
|
7742
7708
|
const objectName = items[1].String?.sval || '';
|
|
7743
|
-
output.push(`${quote_utils_1.QuoteUtils.
|
|
7709
|
+
output.push(`${quote_utils_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`);
|
|
7744
7710
|
}
|
|
7745
7711
|
else {
|
|
7746
7712
|
output.push(this.visit(node.object, context));
|
|
@@ -8010,7 +7976,7 @@ class Deparser {
|
|
|
8010
7976
|
SecLabelStmt(node, context) {
|
|
8011
7977
|
const output = ['SECURITY LABEL'];
|
|
8012
7978
|
if (node.provider) {
|
|
8013
|
-
output.push('FOR',
|
|
7979
|
+
output.push('FOR', quote_utils_1.QuoteUtils.quoteIdentifier(node.provider));
|
|
8014
7980
|
}
|
|
8015
7981
|
output.push('ON');
|
|
8016
7982
|
if (node.objtype) {
|
|
@@ -8163,7 +8129,7 @@ class Deparser {
|
|
|
8163
8129
|
}
|
|
8164
8130
|
output.push('LANGUAGE');
|
|
8165
8131
|
if (node.plname) {
|
|
8166
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
8132
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.plname));
|
|
8167
8133
|
}
|
|
8168
8134
|
if (node.plhandler && node.plhandler.length > 0) {
|
|
8169
8135
|
output.push('HANDLER');
|
|
@@ -8199,7 +8165,7 @@ class Deparser {
|
|
|
8199
8165
|
}
|
|
8200
8166
|
output.push('LANGUAGE');
|
|
8201
8167
|
if (node.lang) {
|
|
8202
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
8168
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.lang));
|
|
8203
8169
|
}
|
|
8204
8170
|
output.push('(');
|
|
8205
8171
|
const transforms = [];
|
|
@@ -8227,7 +8193,7 @@ class Deparser {
|
|
|
8227
8193
|
}
|
|
8228
8194
|
output.push('TRIGGER');
|
|
8229
8195
|
if (node.trigname) {
|
|
8230
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
8196
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.trigname));
|
|
8231
8197
|
}
|
|
8232
8198
|
if (context.isPretty()) {
|
|
8233
8199
|
const components = [];
|
|
@@ -8391,14 +8357,14 @@ class Deparser {
|
|
|
8391
8357
|
output.push('OLD TABLE AS');
|
|
8392
8358
|
}
|
|
8393
8359
|
if (node.name) {
|
|
8394
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
8360
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
8395
8361
|
}
|
|
8396
8362
|
return output.join(' ');
|
|
8397
8363
|
}
|
|
8398
8364
|
CreateEventTrigStmt(node, context) {
|
|
8399
8365
|
const output = ['CREATE EVENT TRIGGER'];
|
|
8400
8366
|
if (node.trigname) {
|
|
8401
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
8367
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.trigname));
|
|
8402
8368
|
}
|
|
8403
8369
|
output.push('ON');
|
|
8404
8370
|
if (node.eventname) {
|
|
@@ -8424,7 +8390,7 @@ class Deparser {
|
|
|
8424
8390
|
AlterEventTrigStmt(node, context) {
|
|
8425
8391
|
const output = ['ALTER EVENT TRIGGER'];
|
|
8426
8392
|
if (node.trigname) {
|
|
8427
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
8393
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.trigname));
|
|
8428
8394
|
}
|
|
8429
8395
|
if (node.tgenabled) {
|
|
8430
8396
|
switch (node.tgenabled) {
|
|
@@ -8559,11 +8525,11 @@ class Deparser {
|
|
|
8559
8525
|
}
|
|
8560
8526
|
output.push('ALL', 'IN', 'TABLESPACE');
|
|
8561
8527
|
if (node.orig_tablespacename) {
|
|
8562
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
8528
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.orig_tablespacename));
|
|
8563
8529
|
}
|
|
8564
8530
|
output.push('SET', 'TABLESPACE');
|
|
8565
8531
|
if (node.new_tablespacename) {
|
|
8566
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
8532
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.new_tablespacename));
|
|
8567
8533
|
}
|
|
8568
8534
|
if (node.nowait) {
|
|
8569
8535
|
output.push('NOWAIT');
|
|
@@ -8587,10 +8553,10 @@ class Deparser {
|
|
|
8587
8553
|
const sequenceName = [];
|
|
8588
8554
|
const seq = node.sequence;
|
|
8589
8555
|
if (seq.schemaname) {
|
|
8590
|
-
sequenceName.push(quote_utils_1.QuoteUtils.
|
|
8556
|
+
sequenceName.push(quote_utils_1.QuoteUtils.quoteIdentifier(seq.schemaname));
|
|
8591
8557
|
}
|
|
8592
8558
|
if (seq.relname) {
|
|
8593
|
-
sequenceName.push(quote_utils_1.QuoteUtils.
|
|
8559
|
+
sequenceName.push(quote_utils_1.QuoteUtils.quoteIdentifier(seq.relname));
|
|
8594
8560
|
}
|
|
8595
8561
|
output.push(sequenceName.join('.'));
|
|
8596
8562
|
}
|
|
@@ -8624,10 +8590,10 @@ class Deparser {
|
|
|
8624
8590
|
const sequenceName = [];
|
|
8625
8591
|
const seq = node.sequence;
|
|
8626
8592
|
if (seq.schemaname) {
|
|
8627
|
-
sequenceName.push(quote_utils_1.QuoteUtils.
|
|
8593
|
+
sequenceName.push(quote_utils_1.QuoteUtils.quoteIdentifier(seq.schemaname));
|
|
8628
8594
|
}
|
|
8629
8595
|
if (seq.relname) {
|
|
8630
|
-
sequenceName.push(quote_utils_1.QuoteUtils.
|
|
8596
|
+
sequenceName.push(quote_utils_1.QuoteUtils.quoteIdentifier(seq.relname));
|
|
8631
8597
|
}
|
|
8632
8598
|
output.push(sequenceName.join('.'));
|
|
8633
8599
|
}
|
|
@@ -8974,7 +8940,7 @@ class Deparser {
|
|
|
8974
8940
|
}
|
|
8975
8941
|
aliasname(node, context) {
|
|
8976
8942
|
if (typeof node === 'string') {
|
|
8977
|
-
return quote_utils_1.QuoteUtils.
|
|
8943
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node);
|
|
8978
8944
|
}
|
|
8979
8945
|
return this.visit(node, context);
|
|
8980
8946
|
}
|
|
@@ -9006,13 +8972,8 @@ class Deparser {
|
|
|
9006
8972
|
const defName = defElem.defname;
|
|
9007
8973
|
const defValue = defElem.arg;
|
|
9008
8974
|
if (defName && defValue) {
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
preservedDefName = `"${defName}"`;
|
|
9012
|
-
}
|
|
9013
|
-
else {
|
|
9014
|
-
preservedDefName = this.preserveOperatorDefElemCase(defName);
|
|
9015
|
-
}
|
|
8975
|
+
const quotedDefName = quote_utils_1.QuoteUtils.quoteIdentifier(defName);
|
|
8976
|
+
const preservedDefName = quotedDefName !== defName ? quotedDefName : this.preserveOperatorDefElemCase(defName);
|
|
9016
8977
|
if ((defName.toLowerCase() === 'commutator' || defName.toLowerCase() === 'negator') && defValue.List) {
|
|
9017
8978
|
const listItems = list_utils_1.ListUtils.unwrapList(defValue.List.items);
|
|
9018
8979
|
if (listItems.length === 1 && listItems[0].String) {
|
|
@@ -9028,7 +8989,7 @@ class Deparser {
|
|
|
9028
8989
|
else if (defName && !defValue) {
|
|
9029
8990
|
// Handle boolean flags like HASHES, MERGES - preserve original case
|
|
9030
8991
|
if (defName === 'Hashes' || defName === 'Merges') {
|
|
9031
|
-
return
|
|
8992
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(defName);
|
|
9032
8993
|
}
|
|
9033
8994
|
return this.preserveOperatorDefElemCase(defName).toUpperCase();
|
|
9034
8995
|
}
|
|
@@ -9167,13 +9128,8 @@ class Deparser {
|
|
|
9167
9128
|
const defName = defElem.defname;
|
|
9168
9129
|
const defValue = defElem.arg;
|
|
9169
9130
|
if (defName && defValue) {
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
preservedDefName = `"${defName}"`;
|
|
9173
|
-
}
|
|
9174
|
-
else {
|
|
9175
|
-
preservedDefName = defName;
|
|
9176
|
-
}
|
|
9131
|
+
const quotedDefName = quote_utils_1.QuoteUtils.quoteIdentifier(defName);
|
|
9132
|
+
const preservedDefName = quotedDefName !== defName ? quotedDefName : defName;
|
|
9177
9133
|
// Handle String arguments with single quotes for string literals
|
|
9178
9134
|
if (defValue.String) {
|
|
9179
9135
|
return `${preservedDefName} = '${defValue.String.sval}'`;
|
|
@@ -9328,7 +9284,7 @@ class Deparser {
|
|
|
9328
9284
|
AlterDatabaseStmt(node, context) {
|
|
9329
9285
|
const output = ['ALTER', 'DATABASE'];
|
|
9330
9286
|
if (node.dbname) {
|
|
9331
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
9287
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
|
|
9332
9288
|
}
|
|
9333
9289
|
if (node.options && node.options.length > 0) {
|
|
9334
9290
|
const options = list_utils_1.ListUtils.unwrapList(node.options).map(opt => this.visit(opt, context));
|
|
@@ -9339,7 +9295,7 @@ class Deparser {
|
|
|
9339
9295
|
AlterDatabaseRefreshCollStmt(node, context) {
|
|
9340
9296
|
const output = ['ALTER', 'DATABASE'];
|
|
9341
9297
|
if (node.dbname) {
|
|
9342
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
9298
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
|
|
9343
9299
|
}
|
|
9344
9300
|
output.push('REFRESH', 'COLLATION', 'VERSION');
|
|
9345
9301
|
return output.join(' ');
|
|
@@ -9347,7 +9303,7 @@ class Deparser {
|
|
|
9347
9303
|
AlterDatabaseSetStmt(node, context) {
|
|
9348
9304
|
const output = ['ALTER', 'DATABASE'];
|
|
9349
9305
|
if (node.dbname) {
|
|
9350
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
9306
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
|
|
9351
9307
|
}
|
|
9352
9308
|
if (node.setstmt) {
|
|
9353
9309
|
const setClause = this.VariableSetStmt(node.setstmt, context);
|
|
@@ -9358,7 +9314,7 @@ class Deparser {
|
|
|
9358
9314
|
DeclareCursorStmt(node, context) {
|
|
9359
9315
|
const output = ['DECLARE'];
|
|
9360
9316
|
if (node.portalname) {
|
|
9361
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
9317
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.portalname));
|
|
9362
9318
|
}
|
|
9363
9319
|
// Handle cursor options before CURSOR keyword
|
|
9364
9320
|
const cursorOptions = [];
|
|
@@ -9400,7 +9356,7 @@ class Deparser {
|
|
|
9400
9356
|
else if (node.pubobjtype === 'PUBLICATIONOBJ_TABLES_IN_SCHEMA') {
|
|
9401
9357
|
output.push('TABLES IN SCHEMA');
|
|
9402
9358
|
if (node.name) {
|
|
9403
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
9359
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
|
|
9404
9360
|
}
|
|
9405
9361
|
}
|
|
9406
9362
|
else if (node.pubobjtype === 'PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA') {
|
|
@@ -9426,7 +9382,7 @@ class Deparser {
|
|
|
9426
9382
|
CreateAmStmt(node, context) {
|
|
9427
9383
|
const output = ['CREATE', 'ACCESS', 'METHOD'];
|
|
9428
9384
|
if (node.amname) {
|
|
9429
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
9385
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.amname));
|
|
9430
9386
|
}
|
|
9431
9387
|
output.push('TYPE');
|
|
9432
9388
|
switch (node.amtype) {
|
|
@@ -9486,7 +9442,7 @@ class Deparser {
|
|
|
9486
9442
|
}
|
|
9487
9443
|
}
|
|
9488
9444
|
if (node.tableSpaceName) {
|
|
9489
|
-
output.push('TABLESPACE', quote_utils_1.QuoteUtils.
|
|
9445
|
+
output.push('TABLESPACE', quote_utils_1.QuoteUtils.quoteIdentifier(node.tableSpaceName));
|
|
9490
9446
|
}
|
|
9491
9447
|
return output.join(' ');
|
|
9492
9448
|
}
|
|
@@ -9644,7 +9600,7 @@ class Deparser {
|
|
|
9644
9600
|
RangeTableFuncCol(node, context) {
|
|
9645
9601
|
const output = [];
|
|
9646
9602
|
if (node.colname) {
|
|
9647
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
9603
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.colname));
|
|
9648
9604
|
}
|
|
9649
9605
|
if (node.for_ordinality) {
|
|
9650
9606
|
output.push('FOR ORDINALITY');
|
|
@@ -9790,10 +9746,10 @@ class Deparser {
|
|
|
9790
9746
|
if (node.op === 'IS_XMLPI') {
|
|
9791
9747
|
if (node.name && node.args && node.args.length > 0) {
|
|
9792
9748
|
const argStrs = list_utils_1.ListUtils.unwrapList(node.args).map(arg => this.visit(arg, context));
|
|
9793
|
-
return `xmlpi(name ${quote_utils_1.QuoteUtils.
|
|
9749
|
+
return `xmlpi(name ${quote_utils_1.QuoteUtils.quoteIdentifier(node.name)}, ${argStrs.join(', ')})`;
|
|
9794
9750
|
}
|
|
9795
9751
|
else if (node.name) {
|
|
9796
|
-
return `xmlpi(name ${quote_utils_1.QuoteUtils.
|
|
9752
|
+
return `xmlpi(name ${quote_utils_1.QuoteUtils.quoteIdentifier(node.name)})`;
|
|
9797
9753
|
}
|
|
9798
9754
|
else {
|
|
9799
9755
|
return 'XMLPI()';
|
|
@@ -9808,7 +9764,7 @@ class Deparser {
|
|
|
9808
9764
|
output.push('XMLELEMENT');
|
|
9809
9765
|
const elementParts = [];
|
|
9810
9766
|
if (node.name) {
|
|
9811
|
-
elementParts.push(`NAME ${quote_utils_1.QuoteUtils.
|
|
9767
|
+
elementParts.push(`NAME ${quote_utils_1.QuoteUtils.quoteIdentifier(node.name)}`);
|
|
9812
9768
|
}
|
|
9813
9769
|
if (node.named_args && node.named_args.length > 0) {
|
|
9814
9770
|
const namedArgStrs = list_utils_1.ListUtils.unwrapList(node.named_args).map(arg => this.visit(arg, context));
|
|
@@ -9908,7 +9864,7 @@ class Deparser {
|
|
|
9908
9864
|
// Handle name and args for operations that don't have special handling
|
|
9909
9865
|
if (node.op !== 'IS_XMLELEMENT' && node.op !== 'IS_XMLPARSE' && node.op !== 'IS_XMLROOT' && node.op !== 'IS_DOCUMENT') {
|
|
9910
9866
|
if (node.name) {
|
|
9911
|
-
const quotedName = quote_utils_1.QuoteUtils.
|
|
9867
|
+
const quotedName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
|
|
9912
9868
|
output.push(`NAME ${quotedName}`);
|
|
9913
9869
|
}
|
|
9914
9870
|
if (node.args && node.args.length > 0) {
|
|
@@ -9929,26 +9885,26 @@ class Deparser {
|
|
|
9929
9885
|
}
|
|
9930
9886
|
schemaname(node, context) {
|
|
9931
9887
|
if (typeof node === 'string') {
|
|
9932
|
-
return quote_utils_1.QuoteUtils.
|
|
9888
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node);
|
|
9933
9889
|
}
|
|
9934
9890
|
if (node && node.String && node.String.sval) {
|
|
9935
|
-
return quote_utils_1.QuoteUtils.
|
|
9891
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.String.sval);
|
|
9936
9892
|
}
|
|
9937
9893
|
// Handle other node types without recursion
|
|
9938
9894
|
if (node && typeof node === 'object') {
|
|
9939
9895
|
if (node.sval !== undefined) {
|
|
9940
|
-
return quote_utils_1.QuoteUtils.
|
|
9896
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.sval);
|
|
9941
9897
|
}
|
|
9942
9898
|
// Handle List nodes that might contain schema names
|
|
9943
9899
|
if (node.List && Array.isArray(node.List.items)) {
|
|
9944
9900
|
const items = node.List.items;
|
|
9945
9901
|
if (items.length > 0 && items[0].String && items[0].String.sval) {
|
|
9946
|
-
return quote_utils_1.QuoteUtils.
|
|
9902
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(items[0].String.sval);
|
|
9947
9903
|
}
|
|
9948
9904
|
}
|
|
9949
9905
|
// For other complex nodes, try to extract string value without recursion
|
|
9950
9906
|
if (node.val !== undefined) {
|
|
9951
|
-
return quote_utils_1.QuoteUtils.
|
|
9907
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.val);
|
|
9952
9908
|
}
|
|
9953
9909
|
return '';
|
|
9954
9910
|
}
|
|
@@ -10011,7 +9967,7 @@ class Deparser {
|
|
|
10011
9967
|
}
|
|
10012
9968
|
output.push('RULE');
|
|
10013
9969
|
if (node.rulename) {
|
|
10014
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
9970
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.rulename));
|
|
10015
9971
|
}
|
|
10016
9972
|
output.push('AS ON');
|
|
10017
9973
|
if (node.event) {
|
|
@@ -10078,42 +10034,42 @@ class Deparser {
|
|
|
10078
10034
|
}
|
|
10079
10035
|
relname(node, context) {
|
|
10080
10036
|
if (typeof node === 'string') {
|
|
10081
|
-
return quote_utils_1.QuoteUtils.
|
|
10037
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node);
|
|
10082
10038
|
}
|
|
10083
10039
|
if (node && node.String && node.String.sval) {
|
|
10084
|
-
return quote_utils_1.QuoteUtils.
|
|
10040
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.String.sval);
|
|
10085
10041
|
}
|
|
10086
10042
|
if (node && typeof node === 'object' && node.relname) {
|
|
10087
|
-
return quote_utils_1.QuoteUtils.
|
|
10043
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.relname);
|
|
10088
10044
|
}
|
|
10089
10045
|
return this.visit(node, context);
|
|
10090
10046
|
}
|
|
10091
10047
|
rel(node, context) {
|
|
10092
10048
|
if (typeof node === 'string') {
|
|
10093
|
-
return quote_utils_1.QuoteUtils.
|
|
10049
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node);
|
|
10094
10050
|
}
|
|
10095
10051
|
if (node && node.String && node.String.sval) {
|
|
10096
|
-
return quote_utils_1.QuoteUtils.
|
|
10052
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.String.sval);
|
|
10097
10053
|
}
|
|
10098
10054
|
if (node && node.RangeVar) {
|
|
10099
10055
|
return this.RangeVar(node.RangeVar, context);
|
|
10100
10056
|
}
|
|
10101
10057
|
if (node && typeof node === 'object' && node.relname) {
|
|
10102
|
-
return quote_utils_1.QuoteUtils.
|
|
10058
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.relname);
|
|
10103
10059
|
}
|
|
10104
10060
|
return this.visit(node, context);
|
|
10105
10061
|
}
|
|
10106
10062
|
objname(node, context) {
|
|
10107
10063
|
if (typeof node === 'string') {
|
|
10108
|
-
return quote_utils_1.QuoteUtils.
|
|
10064
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node);
|
|
10109
10065
|
}
|
|
10110
10066
|
if (node && node.String && node.String.sval) {
|
|
10111
|
-
return quote_utils_1.QuoteUtils.
|
|
10067
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(node.String.sval);
|
|
10112
10068
|
}
|
|
10113
10069
|
if (Array.isArray(node)) {
|
|
10114
10070
|
const parts = node.map(part => {
|
|
10115
10071
|
if (part && part.String && part.String.sval) {
|
|
10116
|
-
return quote_utils_1.QuoteUtils.
|
|
10072
|
+
return quote_utils_1.QuoteUtils.quoteIdentifier(part.String.sval);
|
|
10117
10073
|
}
|
|
10118
10074
|
return this.visit(part, context);
|
|
10119
10075
|
});
|
|
@@ -10184,7 +10140,7 @@ class Deparser {
|
|
|
10184
10140
|
CurrentOfExpr(node, context) {
|
|
10185
10141
|
const output = ['CURRENT OF'];
|
|
10186
10142
|
if (node.cursor_name) {
|
|
10187
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
10143
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.cursor_name));
|
|
10188
10144
|
}
|
|
10189
10145
|
if (node.cursor_param > 0) {
|
|
10190
10146
|
output.push(`$${node.cursor_param}`);
|
|
@@ -10267,7 +10223,7 @@ class Deparser {
|
|
|
10267
10223
|
if (items.length === 2) {
|
|
10268
10224
|
const schemaName = items[0].String?.sval || '';
|
|
10269
10225
|
const domainName = items[1].String?.sval || '';
|
|
10270
|
-
output.push(
|
|
10226
|
+
output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, domainName));
|
|
10271
10227
|
}
|
|
10272
10228
|
else {
|
|
10273
10229
|
output.push(this.visit(node.object, context));
|
|
@@ -10279,7 +10235,7 @@ class Deparser {
|
|
|
10279
10235
|
if (items.length === 2) {
|
|
10280
10236
|
const schemaName = items[0].String?.sval || '';
|
|
10281
10237
|
const typeName = items[1].String?.sval || '';
|
|
10282
|
-
output.push(
|
|
10238
|
+
output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, typeName));
|
|
10283
10239
|
}
|
|
10284
10240
|
else {
|
|
10285
10241
|
output.push(this.visit(node.object, context));
|
|
@@ -10291,7 +10247,7 @@ class Deparser {
|
|
|
10291
10247
|
if (items.length === 2) {
|
|
10292
10248
|
const schemaName = items[0].String?.sval || '';
|
|
10293
10249
|
const conversionName = items[1].String?.sval || '';
|
|
10294
|
-
output.push(
|
|
10250
|
+
output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, conversionName));
|
|
10295
10251
|
}
|
|
10296
10252
|
else {
|
|
10297
10253
|
output.push(this.visit(node.object, context));
|
|
@@ -10303,7 +10259,7 @@ class Deparser {
|
|
|
10303
10259
|
if (items.length === 2) {
|
|
10304
10260
|
const schemaName = items[0].String?.sval || '';
|
|
10305
10261
|
const parserName = items[1].String?.sval || '';
|
|
10306
|
-
output.push(
|
|
10262
|
+
output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, parserName));
|
|
10307
10263
|
}
|
|
10308
10264
|
else {
|
|
10309
10265
|
output.push(this.visit(node.object, context));
|
|
@@ -10315,7 +10271,7 @@ class Deparser {
|
|
|
10315
10271
|
if (items.length === 2) {
|
|
10316
10272
|
const schemaName = items[0].String?.sval || '';
|
|
10317
10273
|
const configName = items[1].String?.sval || '';
|
|
10318
|
-
output.push(
|
|
10274
|
+
output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, configName));
|
|
10319
10275
|
}
|
|
10320
10276
|
else {
|
|
10321
10277
|
output.push(this.visit(node.object, context));
|
|
@@ -10327,7 +10283,7 @@ class Deparser {
|
|
|
10327
10283
|
if (items.length === 2) {
|
|
10328
10284
|
const schemaName = items[0].String?.sval || '';
|
|
10329
10285
|
const templateName = items[1].String?.sval || '';
|
|
10330
|
-
output.push(
|
|
10286
|
+
output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, templateName));
|
|
10331
10287
|
}
|
|
10332
10288
|
else {
|
|
10333
10289
|
output.push(this.visit(node.object, context));
|
|
@@ -10339,7 +10295,7 @@ class Deparser {
|
|
|
10339
10295
|
if (items.length === 2) {
|
|
10340
10296
|
const schemaName = items[0].String?.sval || '';
|
|
10341
10297
|
const dictionaryName = items[1].String?.sval || '';
|
|
10342
|
-
output.push(
|
|
10298
|
+
output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, dictionaryName));
|
|
10343
10299
|
}
|
|
10344
10300
|
else {
|
|
10345
10301
|
output.push(this.visit(node.object, context));
|
|
@@ -10351,13 +10307,13 @@ class Deparser {
|
|
|
10351
10307
|
if (items.length === 2) {
|
|
10352
10308
|
const accessMethod = items[0].String?.sval || '';
|
|
10353
10309
|
const opClassName = items[1].String?.sval || '';
|
|
10354
|
-
output.push(`${quote_utils_1.QuoteUtils.
|
|
10310
|
+
output.push(`${quote_utils_1.QuoteUtils.quoteIdentifier(opClassName)} USING ${accessMethod}`);
|
|
10355
10311
|
}
|
|
10356
10312
|
else if (items.length === 3) {
|
|
10357
10313
|
const accessMethod = items[0].String?.sval || '';
|
|
10358
10314
|
const schemaName = items[1].String?.sval || '';
|
|
10359
10315
|
const opClassName = items[2].String?.sval || '';
|
|
10360
|
-
output.push(`${quote_utils_1.QuoteUtils.
|
|
10316
|
+
output.push(`${quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, opClassName)} USING ${accessMethod}`);
|
|
10361
10317
|
}
|
|
10362
10318
|
else {
|
|
10363
10319
|
output.push(this.visit(node.object, context));
|
|
@@ -10369,13 +10325,13 @@ class Deparser {
|
|
|
10369
10325
|
if (items.length === 2) {
|
|
10370
10326
|
const accessMethod = items[0].String?.sval || '';
|
|
10371
10327
|
const opFamilyName = items[1].String?.sval || '';
|
|
10372
|
-
output.push(`${quote_utils_1.QuoteUtils.
|
|
10328
|
+
output.push(`${quote_utils_1.QuoteUtils.quoteIdentifier(opFamilyName)} USING ${accessMethod}`);
|
|
10373
10329
|
}
|
|
10374
10330
|
else if (items.length === 3) {
|
|
10375
10331
|
const accessMethod = items[0].String?.sval || '';
|
|
10376
10332
|
const schemaName = items[1].String?.sval || '';
|
|
10377
10333
|
const opFamilyName = items[2].String?.sval || '';
|
|
10378
|
-
output.push(`${quote_utils_1.QuoteUtils.
|
|
10334
|
+
output.push(`${quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, opFamilyName)} USING ${accessMethod}`);
|
|
10379
10335
|
}
|
|
10380
10336
|
else {
|
|
10381
10337
|
output.push(this.visit(node.object, context));
|
|
@@ -10387,7 +10343,7 @@ class Deparser {
|
|
|
10387
10343
|
}
|
|
10388
10344
|
output.push('SET SCHEMA');
|
|
10389
10345
|
if (node.newschema) {
|
|
10390
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
10346
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.newschema));
|
|
10391
10347
|
}
|
|
10392
10348
|
return output.join(' ');
|
|
10393
10349
|
}
|
|
@@ -10456,7 +10412,7 @@ class Deparser {
|
|
|
10456
10412
|
}
|
|
10457
10413
|
if (node.servername) {
|
|
10458
10414
|
output.push('SERVER');
|
|
10459
|
-
output.push(quote_utils_1.QuoteUtils.
|
|
10415
|
+
output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
|
|
10460
10416
|
}
|
|
10461
10417
|
if (node.options && node.options.length > 0) {
|
|
10462
10418
|
const foreignTableContext = context.spawn('CreateForeignTableStmt');
|