pgsql-deparser 17.17.2 → 17.18.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/deparser.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Deparser = void 0;
4
4
  const base_1 = require("./visitors/base");
5
5
  const sql_formatter_1 = require("./utils/sql-formatter");
6
- const quote_utils_1 = require("./utils/quote-utils");
6
+ const quotes_1 = require("@pgsql/quotes");
7
7
  const list_utils_1 = require("./utils/list-utils");
8
8
  /**
9
9
  * List of real PostgreSQL built-in types as they appear in pg_catalog.pg_type.typname.
@@ -1200,12 +1200,12 @@ class Deparser {
1200
1200
  ResTarget(node, context) {
1201
1201
  const output = [];
1202
1202
  if (context.update && node.name) {
1203
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
1203
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
1204
1204
  // Handle indirection (array indexing, field access, etc.)
1205
1205
  if (node.indirection && node.indirection.length > 0) {
1206
1206
  const indirectionStrs = list_utils_1.ListUtils.unwrapList(node.indirection).map(item => {
1207
1207
  if (item.String) {
1208
- return `.${quote_utils_1.QuoteUtils.quoteIdentifierAfterDot(item.String.sval || item.String.str)}`;
1208
+ return `.${quotes_1.QuoteUtils.quoteIdentifierAfterDot(item.String.sval || item.String.str)}`;
1209
1209
  }
1210
1210
  return this.visit(item, context);
1211
1211
  });
@@ -1217,12 +1217,12 @@ class Deparser {
1217
1217
  }
1218
1218
  }
1219
1219
  else if (context.insertColumns && node.name) {
1220
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
1220
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
1221
1221
  // Handle indirection for INSERT column lists (e.g., q.c1.r)
1222
1222
  if (node.indirection && node.indirection.length > 0) {
1223
1223
  const indirectionStrs = list_utils_1.ListUtils.unwrapList(node.indirection).map(item => {
1224
1224
  if (item.String) {
1225
- return `.${quote_utils_1.QuoteUtils.quoteIdentifierAfterDot(item.String.sval || item.String.str)}`;
1225
+ return `.${quotes_1.QuoteUtils.quoteIdentifierAfterDot(item.String.sval || item.String.str)}`;
1226
1226
  }
1227
1227
  return this.visit(item, context);
1228
1228
  });
@@ -1235,7 +1235,7 @@ class Deparser {
1235
1235
  }
1236
1236
  if (node.name) {
1237
1237
  output.push('AS');
1238
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
1238
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
1239
1239
  }
1240
1240
  }
1241
1241
  return output.join(' ');
@@ -1249,7 +1249,7 @@ class Deparser {
1249
1249
  if (this.getNodeType(item) === 'ResTarget') {
1250
1250
  const resTarget = this.getNodeData(item);
1251
1251
  const val = resTarget.val ? this.visit(resTarget.val, context) : '';
1252
- const alias = resTarget.name ? ` AS ${quote_utils_1.QuoteUtils.quoteIdentifier(resTarget.name)}` : '';
1252
+ const alias = resTarget.name ? ` AS ${quotes_1.QuoteUtils.quoteIdentifier(resTarget.name)}` : '';
1253
1253
  return val + alias;
1254
1254
  }
1255
1255
  else {
@@ -1305,7 +1305,7 @@ class Deparser {
1305
1305
  const funcname = list_utils_1.ListUtils.unwrapList(node.funcname);
1306
1306
  const args = list_utils_1.ListUtils.unwrapList(node.args);
1307
1307
  const funcnameParts = funcname.map((n) => n.String?.sval || n.String?.str || '').filter((s) => s);
1308
- const name = quote_utils_1.QuoteUtils.quoteDottedName(funcnameParts);
1308
+ const name = quotes_1.QuoteUtils.quoteDottedName(funcnameParts);
1309
1309
  // Handle special SQL syntax functions like XMLEXISTS and EXTRACT
1310
1310
  if (node.funcformat === 'COERCE_SQL_SYNTAX' && name === 'pg_catalog.xmlexists' && args.length >= 2) {
1311
1311
  const xpath = this.visit(args[0], context);
@@ -1560,23 +1560,23 @@ class Deparser {
1560
1560
  else if (nodeAny.sval !== undefined) {
1561
1561
  if (typeof nodeAny.sval === 'object' && nodeAny.sval !== null) {
1562
1562
  if (nodeAny.sval.sval !== undefined) {
1563
- return quote_utils_1.QuoteUtils.formatEString(nodeAny.sval.sval);
1563
+ return quotes_1.QuoteUtils.formatEString(nodeAny.sval.sval);
1564
1564
  }
1565
1565
  else if (nodeAny.sval.String && nodeAny.sval.String.sval !== undefined) {
1566
- return quote_utils_1.QuoteUtils.formatEString(nodeAny.sval.String.sval);
1566
+ return quotes_1.QuoteUtils.formatEString(nodeAny.sval.String.sval);
1567
1567
  }
1568
1568
  else if (Object.keys(nodeAny.sval).length === 0) {
1569
1569
  return "''";
1570
1570
  }
1571
1571
  else {
1572
- return quote_utils_1.QuoteUtils.formatEString(nodeAny.sval.toString());
1572
+ return quotes_1.QuoteUtils.formatEString(nodeAny.sval.toString());
1573
1573
  }
1574
1574
  }
1575
1575
  else if (nodeAny.sval === null) {
1576
1576
  return 'NULL';
1577
1577
  }
1578
1578
  else {
1579
- return quote_utils_1.QuoteUtils.formatEString(nodeAny.sval);
1579
+ return quotes_1.QuoteUtils.formatEString(nodeAny.sval);
1580
1580
  }
1581
1581
  }
1582
1582
  else if (nodeAny.boolval !== undefined) {
@@ -1641,7 +1641,7 @@ class Deparser {
1641
1641
  return nodeAny.val.Float.fval.toString();
1642
1642
  }
1643
1643
  else if (nodeAny.val.String?.sval !== undefined) {
1644
- return quote_utils_1.QuoteUtils.escape(nodeAny.val.String.sval);
1644
+ return quotes_1.QuoteUtils.escape(nodeAny.val.String.sval);
1645
1645
  }
1646
1646
  else if (nodeAny.val.Boolean?.boolval !== undefined) {
1647
1647
  return nodeAny.val.Boolean.boolval ? 'true' : 'false';
@@ -1671,9 +1671,9 @@ class Deparser {
1671
1671
  }
1672
1672
  if (nodeAny.String !== undefined) {
1673
1673
  if (typeof nodeAny.String === 'object' && nodeAny.String.sval !== undefined) {
1674
- return quote_utils_1.QuoteUtils.escape(nodeAny.String.sval);
1674
+ return quotes_1.QuoteUtils.escape(nodeAny.String.sval);
1675
1675
  }
1676
- return quote_utils_1.QuoteUtils.escape(nodeAny.String);
1676
+ return quotes_1.QuoteUtils.escape(nodeAny.String);
1677
1677
  }
1678
1678
  if (Object.keys(nodeAny).length === 0) {
1679
1679
  return 'NULL';
@@ -1687,7 +1687,7 @@ class Deparser {
1687
1687
  const fields = list_utils_1.ListUtils.unwrapList(node.fields);
1688
1688
  return fields.map(field => {
1689
1689
  if (field.String) {
1690
- return quote_utils_1.QuoteUtils.quoteIdentifier(field.String.sval || field.String.str);
1690
+ return quotes_1.QuoteUtils.quoteIdentifier(field.String.sval || field.String.str);
1691
1691
  }
1692
1692
  else if (field.A_Star) {
1693
1693
  return '*';
@@ -1862,7 +1862,7 @@ class Deparser {
1862
1862
  }
1863
1863
  // Use type-name quoting for non-pg_catalog types
1864
1864
  // This allows keywords like 'json', 'int', 'boolean' to remain unquoted in type positions
1865
- let result = mods(quote_utils_1.QuoteUtils.quoteTypeDottedName(names), args);
1865
+ let result = mods(quotes_1.QuoteUtils.quoteTypeDottedName(names), args);
1866
1866
  if (node.arrayBounds && node.arrayBounds.length > 0) {
1867
1867
  result += formatArrayBounds(node.arrayBounds);
1868
1868
  }
@@ -1900,17 +1900,17 @@ class Deparser {
1900
1900
  }
1901
1901
  let tableName = '';
1902
1902
  if (node.catalogname) {
1903
- tableName = quote_utils_1.QuoteUtils.quoteIdentifier(node.catalogname);
1903
+ tableName = quotes_1.QuoteUtils.quoteIdentifier(node.catalogname);
1904
1904
  if (node.schemaname) {
1905
- tableName += '.' + quote_utils_1.QuoteUtils.quoteIdentifierAfterDot(node.schemaname);
1905
+ tableName += '.' + quotes_1.QuoteUtils.quoteIdentifierAfterDot(node.schemaname);
1906
1906
  }
1907
- tableName += '.' + quote_utils_1.QuoteUtils.quoteIdentifierAfterDot(node.relname);
1907
+ tableName += '.' + quotes_1.QuoteUtils.quoteIdentifierAfterDot(node.relname);
1908
1908
  }
1909
1909
  else if (node.schemaname) {
1910
- tableName = quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(node.schemaname, node.relname);
1910
+ tableName = quotes_1.QuoteUtils.quoteQualifiedIdentifier(node.schemaname, node.relname);
1911
1911
  }
1912
1912
  else {
1913
- tableName = quote_utils_1.QuoteUtils.quoteIdentifier(node.relname);
1913
+ tableName = quotes_1.QuoteUtils.quoteIdentifier(node.relname);
1914
1914
  }
1915
1915
  output.push(tableName);
1916
1916
  if (node.alias) {
@@ -2136,7 +2136,7 @@ class Deparser {
2136
2136
  const indirection = list_utils_1.ListUtils.unwrapList(node.indirection);
2137
2137
  for (const subnode of indirection) {
2138
2138
  if (subnode.String || subnode.A_Star) {
2139
- const value = subnode.A_Star ? '*' : quote_utils_1.QuoteUtils.quoteIdentifier(subnode.String.sval || subnode.String.str);
2139
+ const value = subnode.A_Star ? '*' : quotes_1.QuoteUtils.quoteIdentifier(subnode.String.sval || subnode.String.str);
2140
2140
  output.push(`.${value}`);
2141
2141
  }
2142
2142
  else {
@@ -2282,7 +2282,7 @@ class Deparser {
2282
2282
  return output.join(' ');
2283
2283
  }
2284
2284
  quoteIfNeeded(value) {
2285
- return quote_utils_1.QuoteUtils.quoteIdentifier(value);
2285
+ return quotes_1.QuoteUtils.quoteIdentifier(value);
2286
2286
  }
2287
2287
  preserveOperatorDefElemCase(defName) {
2288
2288
  const caseMap = {
@@ -2301,7 +2301,7 @@ class Deparser {
2301
2301
  }
2302
2302
  String(node, context) {
2303
2303
  if (context.isStringLiteral || context.isEnumValue) {
2304
- return quote_utils_1.QuoteUtils.formatEString(node.sval || '');
2304
+ return quotes_1.QuoteUtils.formatEString(node.sval || '');
2305
2305
  }
2306
2306
  const value = node.sval || '';
2307
2307
  if (context.parentNodeTypes.includes('DefElem') ||
@@ -2315,7 +2315,7 @@ class Deparser {
2315
2315
  return value; // Don't quote pure operator symbols like "=" or "-"
2316
2316
  }
2317
2317
  }
2318
- return quote_utils_1.QuoteUtils.quoteIdentifier(value);
2318
+ return quotes_1.QuoteUtils.quoteIdentifier(value);
2319
2319
  }
2320
2320
  Integer(node, context) {
2321
2321
  return node.ival?.toString() || '0';
@@ -2492,7 +2492,7 @@ class Deparser {
2492
2492
  ColumnDef(node, context) {
2493
2493
  const output = [];
2494
2494
  if (node.colname) {
2495
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.colname));
2495
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.colname));
2496
2496
  }
2497
2497
  if (node.typeName) {
2498
2498
  output.push(this.TypeName(node.typeName, context));
@@ -2533,7 +2533,7 @@ class Deparser {
2533
2533
  // Handle constraint name if present
2534
2534
  if (node.conname && (node.contype === 'CONSTR_CHECK' || node.contype === 'CONSTR_UNIQUE' || node.contype === 'CONSTR_PRIMARY' || node.contype === 'CONSTR_FOREIGN')) {
2535
2535
  output.push('CONSTRAINT');
2536
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.conname));
2536
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.conname));
2537
2537
  }
2538
2538
  switch (node.contype) {
2539
2539
  case 'CONSTR_NULL':
@@ -3430,7 +3430,7 @@ class Deparser {
3430
3430
  output.push('IF NOT EXISTS');
3431
3431
  }
3432
3432
  if (node.idxname) {
3433
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.idxname));
3433
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.idxname));
3434
3434
  }
3435
3435
  output.push('ON');
3436
3436
  if (node.relation) {
@@ -3464,14 +3464,14 @@ class Deparser {
3464
3464
  }
3465
3465
  if (node.tableSpace) {
3466
3466
  output.push('TABLESPACE');
3467
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.tableSpace));
3467
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.tableSpace));
3468
3468
  }
3469
3469
  return output.join(' ');
3470
3470
  }
3471
3471
  IndexElem(node, context) {
3472
3472
  const output = [];
3473
3473
  if (node.name) {
3474
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
3474
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
3475
3475
  }
3476
3476
  else if (node.expr) {
3477
3477
  output.push(context.parens(this.visit(node.expr, context)));
@@ -3522,7 +3522,7 @@ class Deparser {
3522
3522
  PartitionElem(node, context) {
3523
3523
  const output = [];
3524
3524
  if (node.name) {
3525
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
3525
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
3526
3526
  }
3527
3527
  else if (node.expr) {
3528
3528
  output.push(context.parens(this.visit(node.expr, context)));
@@ -3772,19 +3772,19 @@ class Deparser {
3772
3772
  case 'TRANS_STMT_SAVEPOINT':
3773
3773
  output.push('SAVEPOINT');
3774
3774
  if (node.savepoint_name) {
3775
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
3775
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
3776
3776
  }
3777
3777
  break;
3778
3778
  case 'TRANS_STMT_RELEASE':
3779
3779
  output.push('RELEASE SAVEPOINT');
3780
3780
  if (node.savepoint_name) {
3781
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
3781
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
3782
3782
  }
3783
3783
  break;
3784
3784
  case 'TRANS_STMT_ROLLBACK_TO':
3785
3785
  output.push('ROLLBACK TO');
3786
3786
  if (node.savepoint_name) {
3787
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
3787
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.savepoint_name));
3788
3788
  }
3789
3789
  break;
3790
3790
  case 'TRANS_STMT_PREPARE':
@@ -3881,16 +3881,16 @@ class Deparser {
3881
3881
  return this.visit(arg, context);
3882
3882
  }).join(', ') : '';
3883
3883
  // Handle args - always include TO clause if args exist (even if empty string)
3884
- const paramName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
3884
+ const paramName = quotes_1.QuoteUtils.quoteIdentifier(node.name);
3885
3885
  if (!node.args || node.args.length === 0) {
3886
3886
  return `SET ${localPrefix}${paramName}`;
3887
3887
  }
3888
3888
  return `SET ${localPrefix}${paramName} TO ${args}`;
3889
3889
  case 'VAR_SET_DEFAULT':
3890
- const defaultParamName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
3890
+ const defaultParamName = quotes_1.QuoteUtils.quoteIdentifier(node.name);
3891
3891
  return `SET ${defaultParamName} TO DEFAULT`;
3892
3892
  case 'VAR_SET_CURRENT':
3893
- const currentParamName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
3893
+ const currentParamName = quotes_1.QuoteUtils.quoteIdentifier(node.name);
3894
3894
  return `SET ${currentParamName} FROM CURRENT`;
3895
3895
  case 'VAR_SET_MULTI':
3896
3896
  if (node.name === 'TRANSACTION' || node.name === 'SESSION CHARACTERISTICS') {
@@ -3964,7 +3964,7 @@ class Deparser {
3964
3964
  return `SET ${assignments}`;
3965
3965
  }
3966
3966
  case 'VAR_RESET':
3967
- const resetParamName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
3967
+ const resetParamName = quotes_1.QuoteUtils.quoteIdentifier(node.name);
3968
3968
  return `RESET ${resetParamName}`;
3969
3969
  case 'VAR_RESET_ALL':
3970
3970
  return 'RESET ALL';
@@ -3984,7 +3984,7 @@ class Deparser {
3984
3984
  output.push('IF NOT EXISTS');
3985
3985
  }
3986
3986
  if (node.schemaname) {
3987
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.schemaname));
3987
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.schemaname));
3988
3988
  }
3989
3989
  if (node.authrole) {
3990
3990
  output.push('AUTHORIZATION');
@@ -4233,7 +4233,7 @@ class Deparser {
4233
4233
  if (objList && objList.List && objList.List.items) {
4234
4234
  const items = objList.List.items.map((item) => {
4235
4235
  if (item.String && item.String.sval) {
4236
- return quote_utils_1.QuoteUtils.quoteIdentifier(item.String.sval);
4236
+ return quotes_1.QuoteUtils.quoteIdentifier(item.String.sval);
4237
4237
  }
4238
4238
  return this.visit(item, context);
4239
4239
  }).filter((name) => name && name.trim());
@@ -4267,13 +4267,13 @@ class Deparser {
4267
4267
  if (items.length === 2) {
4268
4268
  const accessMethod = items[0];
4269
4269
  const objectName = items[1];
4270
- return `${quote_utils_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`;
4270
+ return `${quotes_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`;
4271
4271
  }
4272
4272
  else if (items.length === 3) {
4273
4273
  const accessMethod = items[0];
4274
4274
  const schemaName = items[1];
4275
4275
  const objectName = items[2];
4276
- return `${quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, objectName)} USING ${accessMethod}`;
4276
+ return `${quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, objectName)} USING ${accessMethod}`;
4277
4277
  }
4278
4278
  return items.join('.');
4279
4279
  }
@@ -4316,7 +4316,7 @@ class Deparser {
4316
4316
  if (objList && objList.List && objList.List.items) {
4317
4317
  const items = objList.List.items.map((item) => {
4318
4318
  if (item.String && item.String.sval) {
4319
- return quote_utils_1.QuoteUtils.quoteIdentifier(item.String.sval);
4319
+ return quotes_1.QuoteUtils.quoteIdentifier(item.String.sval);
4320
4320
  }
4321
4321
  return this.visit(item, context);
4322
4322
  }).filter((name) => name && name.trim());
@@ -4364,7 +4364,7 @@ class Deparser {
4364
4364
  PLAssignStmt(node, context) {
4365
4365
  const output = [];
4366
4366
  if (node.name) {
4367
- let nameWithIndirection = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
4367
+ let nameWithIndirection = quotes_1.QuoteUtils.quoteIdentifier(node.name);
4368
4368
  if (node.indirection && node.indirection.length > 0) {
4369
4369
  const indirectionStr = node.indirection
4370
4370
  .map((ind) => this.visit(ind, context))
@@ -4513,7 +4513,7 @@ class Deparser {
4513
4513
  const parts = [];
4514
4514
  const indentedParts = [];
4515
4515
  if (colDefData.colname) {
4516
- parts.push(quote_utils_1.QuoteUtils.quoteIdentifier(colDefData.colname));
4516
+ parts.push(quotes_1.QuoteUtils.quoteIdentifier(colDefData.colname));
4517
4517
  }
4518
4518
  if (colDefData.typeName) {
4519
4519
  parts.push(this.TypeName(colDefData.typeName, context));
@@ -4571,7 +4571,7 @@ class Deparser {
4571
4571
  else {
4572
4572
  const parts = [];
4573
4573
  if (colDefData.colname) {
4574
- parts.push(quote_utils_1.QuoteUtils.quoteIdentifier(colDefData.colname));
4574
+ parts.push(quotes_1.QuoteUtils.quoteIdentifier(colDefData.colname));
4575
4575
  }
4576
4576
  if (colDefData.typeName) {
4577
4577
  parts.push(this.TypeName(colDefData.typeName, context));
@@ -4625,7 +4625,7 @@ class Deparser {
4625
4625
  }
4626
4626
  }
4627
4627
  if (node.name) {
4628
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4628
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4629
4629
  }
4630
4630
  if (node.behavior === 'DROP_CASCADE') {
4631
4631
  output.push('CASCADE');
@@ -4642,7 +4642,7 @@ class Deparser {
4642
4642
  output.push('ALTER COLUMN');
4643
4643
  }
4644
4644
  if (node.name) {
4645
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4645
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4646
4646
  }
4647
4647
  output.push('TYPE');
4648
4648
  if (node.def) {
@@ -4669,7 +4669,7 @@ class Deparser {
4669
4669
  case 'AT_SetTableSpace':
4670
4670
  output.push('SET TABLESPACE');
4671
4671
  if (node.name) {
4672
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4672
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4673
4673
  }
4674
4674
  break;
4675
4675
  case 'AT_AddConstraint':
@@ -4687,7 +4687,7 @@ class Deparser {
4687
4687
  output.push('DROP CONSTRAINT');
4688
4688
  }
4689
4689
  if (node.name) {
4690
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4690
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4691
4691
  }
4692
4692
  if (node.behavior === 'DROP_CASCADE') {
4693
4693
  output.push('CASCADE');
@@ -4725,7 +4725,7 @@ class Deparser {
4725
4725
  case 'AT_ColumnDefault':
4726
4726
  output.push('ALTER COLUMN');
4727
4727
  if (node.name) {
4728
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4728
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4729
4729
  }
4730
4730
  if (node.def) {
4731
4731
  output.push('SET DEFAULT');
@@ -4738,7 +4738,7 @@ class Deparser {
4738
4738
  case 'AT_SetStorage':
4739
4739
  output.push('ALTER COLUMN');
4740
4740
  if (node.name) {
4741
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4741
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4742
4742
  }
4743
4743
  output.push('SET STORAGE');
4744
4744
  if (node.def) {
@@ -4749,7 +4749,7 @@ class Deparser {
4749
4749
  case 'AT_ClusterOn':
4750
4750
  output.push('CLUSTER ON');
4751
4751
  if (node.name) {
4752
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4752
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4753
4753
  }
4754
4754
  break;
4755
4755
  case 'AT_DropCluster':
@@ -4776,21 +4776,21 @@ class Deparser {
4776
4776
  case 'AT_SetNotNull':
4777
4777
  output.push('ALTER COLUMN');
4778
4778
  if (node.name) {
4779
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4779
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4780
4780
  }
4781
4781
  output.push('SET NOT NULL');
4782
4782
  break;
4783
4783
  case 'AT_DropNotNull':
4784
4784
  output.push('ALTER COLUMN');
4785
4785
  if (node.name) {
4786
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4786
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4787
4787
  }
4788
4788
  output.push('DROP NOT NULL');
4789
4789
  break;
4790
4790
  case 'AT_SetStatistics':
4791
4791
  output.push('ALTER COLUMN');
4792
4792
  if (node.name) {
4793
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4793
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4794
4794
  }
4795
4795
  else if (node.num !== undefined && node.num !== null) {
4796
4796
  output.push(node.num.toString());
@@ -4803,7 +4803,7 @@ class Deparser {
4803
4803
  case 'AT_SetOptions':
4804
4804
  output.push('ALTER COLUMN');
4805
4805
  if (node.name) {
4806
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4806
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4807
4807
  }
4808
4808
  output.push('SET');
4809
4809
  if (node.def) {
@@ -4820,7 +4820,7 @@ class Deparser {
4820
4820
  case 'AT_ResetOptions':
4821
4821
  output.push('ALTER COLUMN');
4822
4822
  if (node.name) {
4823
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4823
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4824
4824
  }
4825
4825
  output.push('RESET');
4826
4826
  if (node.def) {
@@ -4837,7 +4837,7 @@ class Deparser {
4837
4837
  case 'AT_SetCompression':
4838
4838
  output.push('ALTER COLUMN');
4839
4839
  if (node.name) {
4840
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4840
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4841
4841
  }
4842
4842
  output.push('SET COMPRESSION');
4843
4843
  if (node.def) {
@@ -4847,31 +4847,31 @@ class Deparser {
4847
4847
  case 'AT_ValidateConstraint':
4848
4848
  output.push('VALIDATE CONSTRAINT');
4849
4849
  if (node.name) {
4850
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4850
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4851
4851
  }
4852
4852
  break;
4853
4853
  case 'AT_EnableTrig':
4854
4854
  output.push('ENABLE TRIGGER');
4855
4855
  if (node.name) {
4856
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4856
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4857
4857
  }
4858
4858
  break;
4859
4859
  case 'AT_EnableAlwaysTrig':
4860
4860
  output.push('ENABLE ALWAYS TRIGGER');
4861
4861
  if (node.name) {
4862
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4862
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4863
4863
  }
4864
4864
  break;
4865
4865
  case 'AT_EnableReplicaTrig':
4866
4866
  output.push('ENABLE REPLICA TRIGGER');
4867
4867
  if (node.name) {
4868
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4868
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4869
4869
  }
4870
4870
  break;
4871
4871
  case 'AT_DisableTrig':
4872
4872
  output.push('DISABLE TRIGGER');
4873
4873
  if (node.name) {
4874
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4874
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4875
4875
  }
4876
4876
  break;
4877
4877
  case 'AT_EnableTrigAll':
@@ -4889,31 +4889,31 @@ class Deparser {
4889
4889
  case 'AT_EnableRule':
4890
4890
  output.push('ENABLE RULE');
4891
4891
  if (node.name) {
4892
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4892
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4893
4893
  }
4894
4894
  break;
4895
4895
  case 'AT_EnableAlwaysRule':
4896
4896
  output.push('ENABLE ALWAYS RULE');
4897
4897
  if (node.name) {
4898
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4898
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4899
4899
  }
4900
4900
  break;
4901
4901
  case 'AT_EnableReplicaRule':
4902
4902
  output.push('ENABLE REPLICA RULE');
4903
4903
  if (node.name) {
4904
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4904
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4905
4905
  }
4906
4906
  break;
4907
4907
  case 'AT_DisableRule':
4908
4908
  output.push('DISABLE RULE');
4909
4909
  if (node.name) {
4910
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4910
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4911
4911
  }
4912
4912
  break;
4913
4913
  case 'AT_SetAccessMethod':
4914
4914
  output.push('SET ACCESS METHOD');
4915
4915
  if (node.name) {
4916
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4916
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4917
4917
  }
4918
4918
  else {
4919
4919
  // Handle DEFAULT access method case
@@ -4967,7 +4967,7 @@ class Deparser {
4967
4967
  case 'AT_CookedColumnDefault':
4968
4968
  output.push('ALTER COLUMN');
4969
4969
  if (node.name) {
4970
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4970
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4971
4971
  }
4972
4972
  if (node.def) {
4973
4973
  output.push('SET DEFAULT');
@@ -4980,7 +4980,7 @@ class Deparser {
4980
4980
  case 'AT_SetExpression':
4981
4981
  output.push('ALTER COLUMN');
4982
4982
  if (node.name) {
4983
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4983
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4984
4984
  }
4985
4985
  output.push('SET EXPRESSION');
4986
4986
  if (node.def) {
@@ -4990,14 +4990,14 @@ class Deparser {
4990
4990
  case 'AT_DropExpression':
4991
4991
  output.push('ALTER COLUMN');
4992
4992
  if (node.name) {
4993
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
4993
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
4994
4994
  }
4995
4995
  output.push('DROP EXPRESSION');
4996
4996
  break;
4997
4997
  case 'AT_CheckNotNull':
4998
4998
  output.push('ALTER COLUMN');
4999
4999
  if (node.name) {
5000
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
5000
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
5001
5001
  }
5002
5002
  output.push('SET NOT NULL');
5003
5003
  break;
@@ -5030,7 +5030,7 @@ class Deparser {
5030
5030
  if (node.def && this.getNodeType(node.def) === 'Constraint') {
5031
5031
  const constraintData = this.getNodeData(node.def);
5032
5032
  if (constraintData.conname) {
5033
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(constraintData.conname));
5033
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(constraintData.conname));
5034
5034
  if (constraintData.deferrable !== undefined) {
5035
5035
  output.push(constraintData.deferrable ? 'DEFERRABLE' : 'NOT DEFERRABLE');
5036
5036
  }
@@ -5040,7 +5040,7 @@ class Deparser {
5040
5040
  }
5041
5041
  }
5042
5042
  else if (node.name) {
5043
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
5043
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
5044
5044
  if (node.def) {
5045
5045
  output.push(this.visit(node.def, context));
5046
5046
  }
@@ -5061,7 +5061,7 @@ class Deparser {
5061
5061
  case 'AT_AlterColumnGenericOptions':
5062
5062
  output.push('ALTER COLUMN');
5063
5063
  if (node.name) {
5064
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
5064
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
5065
5065
  }
5066
5066
  output.push('OPTIONS');
5067
5067
  if (node.def) {
@@ -5115,7 +5115,7 @@ class Deparser {
5115
5115
  case 'AT_AddIdentity':
5116
5116
  output.push('ALTER COLUMN');
5117
5117
  if (node.name) {
5118
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
5118
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
5119
5119
  }
5120
5120
  output.push('ADD');
5121
5121
  if (node.def) {
@@ -5125,7 +5125,7 @@ class Deparser {
5125
5125
  case 'AT_SetIdentity':
5126
5126
  output.push('ALTER COLUMN');
5127
5127
  if (node.name) {
5128
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
5128
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
5129
5129
  }
5130
5130
  output.push('SET');
5131
5131
  if (node.def) {
@@ -5135,7 +5135,7 @@ class Deparser {
5135
5135
  case 'AT_DropIdentity':
5136
5136
  output.push('ALTER COLUMN');
5137
5137
  if (node.name) {
5138
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
5138
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
5139
5139
  }
5140
5140
  output.push('DROP IDENTITY');
5141
5141
  if (node.behavior === 'DROP_CASCADE') {
@@ -5170,7 +5170,7 @@ class Deparser {
5170
5170
  }
5171
5171
  if (node.funcname && node.funcname.length > 0) {
5172
5172
  const funcnameParts = node.funcname.map((name) => name.String?.sval || name.String?.str || '').filter((s) => s);
5173
- const funcName = quote_utils_1.QuoteUtils.quoteDottedName(funcnameParts);
5173
+ const funcName = quotes_1.QuoteUtils.quoteDottedName(funcnameParts);
5174
5174
  if (node.parameters && node.parameters.length > 0) {
5175
5175
  const params = node.parameters
5176
5176
  .filter((param) => {
@@ -5287,7 +5287,7 @@ class Deparser {
5287
5287
  }
5288
5288
  }
5289
5289
  if (node.name) {
5290
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
5290
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
5291
5291
  }
5292
5292
  if (node.argType) {
5293
5293
  output.push(this.TypeName(node.argType, context));
@@ -5359,7 +5359,7 @@ class Deparser {
5359
5359
  output.push('ROLE');
5360
5360
  }
5361
5361
  if (node.role) {
5362
- const roleName = quote_utils_1.QuoteUtils.quoteIdentifier(node.role);
5362
+ const roleName = quotes_1.QuoteUtils.quoteIdentifier(node.role);
5363
5363
  output.push(roleName);
5364
5364
  }
5365
5365
  if (node.options) {
@@ -5401,7 +5401,7 @@ class Deparser {
5401
5401
  if (context.parentNodeTypes.includes('DefineStmt') &&
5402
5402
  ['hashes', 'merges'].includes(node.defname.toLowerCase()) && !node.arg) {
5403
5403
  if (node.defname !== node.defname.toLowerCase() && node.defname !== node.defname.toUpperCase()) {
5404
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
5404
+ return quotes_1.QuoteUtils.quoteIdentifier(node.defname);
5405
5405
  }
5406
5406
  return node.defname.charAt(0).toUpperCase() + node.defname.slice(1).toLowerCase();
5407
5407
  }
@@ -5423,7 +5423,7 @@ class Deparser {
5423
5423
  const finalValue = typeof argValue === 'string' && !argValue.startsWith("'")
5424
5424
  ? `'${argValue}'`
5425
5425
  : argValue;
5426
- const quotedDefname = quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
5426
+ const quotedDefname = quotes_1.QuoteUtils.quoteIdentifier(node.defname);
5427
5427
  if (node.defaction === 'DEFELEM_ADD') {
5428
5428
  return `ADD ${quotedDefname} ${finalValue}`;
5429
5429
  }
@@ -5447,7 +5447,7 @@ class Deparser {
5447
5447
  else if (node.defaction === 'DEFELEM_SET') {
5448
5448
  return `SET ${node.defname} ${quotedValue}`;
5449
5449
  }
5450
- const quotedDefname = quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
5450
+ const quotedDefname = quotes_1.QuoteUtils.quoteIdentifier(node.defname);
5451
5451
  return `${quotedDefname} ${quotedValue}`;
5452
5452
  }
5453
5453
  else if (node.defaction === 'DEFELEM_DROP') {
@@ -5498,16 +5498,16 @@ class Deparser {
5498
5498
  }
5499
5499
  if (context.parentNodeTypes.includes('CreatedbStmt') || context.parentNodeTypes.includes('DropdbStmt')) {
5500
5500
  const quotedValue = typeof argValue === 'string'
5501
- ? quote_utils_1.QuoteUtils.escape(argValue)
5501
+ ? quotes_1.QuoteUtils.escape(argValue)
5502
5502
  : argValue;
5503
5503
  return `${node.defname} = ${quotedValue}`;
5504
5504
  }
5505
5505
  // CreateForeignServerStmt and AlterForeignServerStmt use space format like CreateFdwStmt
5506
5506
  if (context.parentNodeTypes.includes('CreateForeignServerStmt') || context.parentNodeTypes.includes('AlterForeignServerStmt')) {
5507
5507
  const quotedValue = typeof argValue === 'string'
5508
- ? quote_utils_1.QuoteUtils.escape(argValue)
5508
+ ? quotes_1.QuoteUtils.escape(argValue)
5509
5509
  : argValue;
5510
- const quotedDefname = quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
5510
+ const quotedDefname = quotes_1.QuoteUtils.quoteIdentifier(node.defname);
5511
5511
  return `${quotedDefname} ${quotedValue}`;
5512
5512
  }
5513
5513
  if (context.parentNodeTypes.includes('CreateRoleStmt') || context.parentNodeTypes.includes('AlterRoleStmt')) {
@@ -5582,7 +5582,7 @@ class Deparser {
5582
5582
  if (this.getNodeType(item) === 'String') {
5583
5583
  // Check if this identifier needs quotes to preserve case
5584
5584
  const value = itemData.sval;
5585
- return quote_utils_1.QuoteUtils.quoteIdentifier(value);
5585
+ return quotes_1.QuoteUtils.quoteIdentifier(value);
5586
5586
  }
5587
5587
  return this.visit(item, context);
5588
5588
  });
@@ -5730,7 +5730,7 @@ class Deparser {
5730
5730
  return `${node.defname.toUpperCase()} ${argValue}`;
5731
5731
  }
5732
5732
  const quotedValue = typeof argValue === 'string'
5733
- ? quote_utils_1.QuoteUtils.escape(argValue)
5733
+ ? quotes_1.QuoteUtils.escape(argValue)
5734
5734
  : argValue;
5735
5735
  return `${node.defname} ${quotedValue}`;
5736
5736
  }
@@ -5792,7 +5792,7 @@ class Deparser {
5792
5792
  return `${node.defname}=${argValue}`;
5793
5793
  }
5794
5794
  const quotedValue = typeof argValue === 'string'
5795
- ? quote_utils_1.QuoteUtils.escape(argValue)
5795
+ ? quotes_1.QuoteUtils.escape(argValue)
5796
5796
  : argValue;
5797
5797
  return `${node.defname} = ${quotedValue}`;
5798
5798
  }
@@ -5830,12 +5830,12 @@ class Deparser {
5830
5830
  // Handle boolean flags (no arguments) - preserve quoted case
5831
5831
  if (['hashes', 'merges'].includes(node.defname.toLowerCase())) {
5832
5832
  if (node.defname !== node.defname.toLowerCase() && node.defname !== node.defname.toUpperCase()) {
5833
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
5833
+ return quotes_1.QuoteUtils.quoteIdentifier(node.defname);
5834
5834
  }
5835
5835
  return preservedName.toUpperCase();
5836
5836
  }
5837
5837
  // Handle CREATE AGGREGATE quoted identifiers - preserve quotes when needed
5838
- const quotedDefname = quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
5838
+ const quotedDefname = quotes_1.QuoteUtils.quoteIdentifier(node.defname);
5839
5839
  if (quotedDefname !== node.defname) {
5840
5840
  if (node.arg) {
5841
5841
  if (this.getNodeType(node.arg) === 'String') {
@@ -5888,7 +5888,7 @@ class Deparser {
5888
5888
  }
5889
5889
  }
5890
5890
  const quotedValue = typeof argValue === 'string'
5891
- ? quote_utils_1.QuoteUtils.escape(argValue)
5891
+ ? quotes_1.QuoteUtils.escape(argValue)
5892
5892
  : argValue;
5893
5893
  return `${node.defname} = ${quotedValue}`;
5894
5894
  }
@@ -5896,7 +5896,7 @@ class Deparser {
5896
5896
  if (context.parentNodeTypes.includes('DefineStmt') && !node.arg) {
5897
5897
  // Check if the original defname appears to be quoted (mixed case that's not all upper/lower)
5898
5898
  if (node.defname !== node.defname.toLowerCase() && node.defname !== node.defname.toUpperCase()) {
5899
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.defname);
5899
+ return quotes_1.QuoteUtils.quoteIdentifier(node.defname);
5900
5900
  }
5901
5901
  }
5902
5902
  return node.defname.toUpperCase();
@@ -6080,7 +6080,7 @@ class Deparser {
6080
6080
  case 'REPLICA_IDENTITY_INDEX':
6081
6081
  output.push('USING', 'INDEX');
6082
6082
  if (node.name) {
6083
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
6083
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
6084
6084
  }
6085
6085
  break;
6086
6086
  default:
@@ -6139,7 +6139,7 @@ class Deparser {
6139
6139
  output.push('IF', 'EXISTS');
6140
6140
  }
6141
6141
  if (node.name) {
6142
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
6142
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
6143
6143
  }
6144
6144
  if (node.behavior === 'DROP_CASCADE') {
6145
6145
  output.push('CASCADE');
@@ -6148,7 +6148,7 @@ class Deparser {
6148
6148
  case 'AT_ValidateConstraint':
6149
6149
  output.push('VALIDATE', 'CONSTRAINT');
6150
6150
  if (node.name) {
6151
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
6151
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
6152
6152
  }
6153
6153
  break;
6154
6154
  case 'C':
@@ -6165,7 +6165,7 @@ class Deparser {
6165
6165
  output.push('IF', 'EXISTS');
6166
6166
  }
6167
6167
  if (node.name) {
6168
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
6168
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
6169
6169
  }
6170
6170
  if (node.behavior === 'DROP_CASCADE') {
6171
6171
  output.push('CASCADE');
@@ -6174,7 +6174,7 @@ class Deparser {
6174
6174
  case 'V':
6175
6175
  output.push('VALIDATE', 'CONSTRAINT');
6176
6176
  if (node.name) {
6177
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
6177
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
6178
6178
  }
6179
6179
  break;
6180
6180
  case 'O':
@@ -6526,7 +6526,7 @@ class Deparser {
6526
6526
  output.push('NULL');
6527
6527
  }
6528
6528
  else if (node.comment) {
6529
- output.push(quote_utils_1.QuoteUtils.formatEString(node.comment));
6529
+ output.push(quotes_1.QuoteUtils.formatEString(node.comment));
6530
6530
  }
6531
6531
  return output.join(' ');
6532
6532
  }
@@ -6563,7 +6563,7 @@ class Deparser {
6563
6563
  const output = [];
6564
6564
  const initialParts = ['CREATE', 'POLICY'];
6565
6565
  if (node.policy_name) {
6566
- initialParts.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.policy_name));
6566
+ initialParts.push(quotes_1.QuoteUtils.quoteIdentifier(node.policy_name));
6567
6567
  }
6568
6568
  output.push(initialParts.join(' '));
6569
6569
  // Add ON clause on new line in pretty mode
@@ -6640,7 +6640,7 @@ class Deparser {
6640
6640
  AlterPolicyStmt(node, context) {
6641
6641
  const output = ['ALTER', 'POLICY'];
6642
6642
  if (node.policy_name) {
6643
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.policy_name));
6643
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.policy_name));
6644
6644
  }
6645
6645
  if (node.table) {
6646
6646
  output.push('ON');
@@ -6676,7 +6676,7 @@ class Deparser {
6676
6676
  }
6677
6677
  output.push('SERVER');
6678
6678
  if (node.servername) {
6679
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
6679
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.servername));
6680
6680
  }
6681
6681
  if (node.options && node.options.length > 0) {
6682
6682
  output.push('OPTIONS');
@@ -6724,7 +6724,7 @@ class Deparser {
6724
6724
  CreatePublicationStmt(node, context) {
6725
6725
  const output = ['CREATE', 'PUBLICATION'];
6726
6726
  if (node.pubname) {
6727
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.pubname));
6727
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.pubname));
6728
6728
  }
6729
6729
  if (node.pubobjects && node.pubobjects.length > 0) {
6730
6730
  output.push('FOR', 'TABLE');
@@ -6744,7 +6744,7 @@ class Deparser {
6744
6744
  CreateSubscriptionStmt(node, context) {
6745
6745
  const output = ['CREATE', 'SUBSCRIPTION'];
6746
6746
  if (node.subname) {
6747
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
6747
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.subname));
6748
6748
  }
6749
6749
  output.push('CONNECTION');
6750
6750
  if (node.conninfo) {
@@ -6765,7 +6765,7 @@ class Deparser {
6765
6765
  AlterPublicationStmt(node, context) {
6766
6766
  const output = ['ALTER', 'PUBLICATION'];
6767
6767
  if (node.pubname) {
6768
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.pubname));
6768
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.pubname));
6769
6769
  }
6770
6770
  if (node.action) {
6771
6771
  switch (node.action) {
@@ -6800,7 +6800,7 @@ class Deparser {
6800
6800
  AlterSubscriptionStmt(node, context) {
6801
6801
  const output = ['ALTER', 'SUBSCRIPTION'];
6802
6802
  if (node.subname) {
6803
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
6803
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.subname));
6804
6804
  }
6805
6805
  if (node.kind) {
6806
6806
  switch (node.kind) {
@@ -6846,7 +6846,7 @@ class Deparser {
6846
6846
  output.push('IF EXISTS');
6847
6847
  }
6848
6848
  if (node.subname) {
6849
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
6849
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.subname));
6850
6850
  }
6851
6851
  if (node.behavior) {
6852
6852
  switch (node.behavior) {
@@ -7091,7 +7091,7 @@ class Deparser {
7091
7091
  ClosePortalStmt(node, context) {
7092
7092
  const output = ['CLOSE'];
7093
7093
  if (node.portalname) {
7094
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.portalname));
7094
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.portalname));
7095
7095
  }
7096
7096
  else {
7097
7097
  output.push('ALL');
@@ -7149,7 +7149,7 @@ class Deparser {
7149
7149
  output.push('ALL');
7150
7150
  }
7151
7151
  if (node.portalname) {
7152
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.portalname));
7152
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.portalname));
7153
7153
  }
7154
7154
  return output.join(' ');
7155
7155
  }
@@ -7219,7 +7219,7 @@ class Deparser {
7219
7219
  AlterFdwStmt(node, context) {
7220
7220
  const output = ['ALTER', 'FOREIGN', 'DATA', 'WRAPPER'];
7221
7221
  if (node.fdwname) {
7222
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.fdwname));
7222
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.fdwname));
7223
7223
  }
7224
7224
  if (node.func_options && node.func_options.length > 0) {
7225
7225
  const fdwContext = context.spawn('AlterFdwStmt');
@@ -7240,16 +7240,16 @@ class Deparser {
7240
7240
  output.push('IF', 'NOT', 'EXISTS');
7241
7241
  }
7242
7242
  if (node.servername) {
7243
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
7243
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.servername));
7244
7244
  }
7245
7245
  if (node.servertype) {
7246
- output.push('TYPE', quote_utils_1.QuoteUtils.escape(node.servertype));
7246
+ output.push('TYPE', quotes_1.QuoteUtils.escape(node.servertype));
7247
7247
  }
7248
7248
  if (node.version) {
7249
- output.push('VERSION', quote_utils_1.QuoteUtils.escape(node.version));
7249
+ output.push('VERSION', quotes_1.QuoteUtils.escape(node.version));
7250
7250
  }
7251
7251
  if (node.fdwname) {
7252
- output.push('FOREIGN', 'DATA', 'WRAPPER', quote_utils_1.QuoteUtils.quoteIdentifier(node.fdwname));
7252
+ output.push('FOREIGN', 'DATA', 'WRAPPER', quotes_1.QuoteUtils.quoteIdentifier(node.fdwname));
7253
7253
  }
7254
7254
  if (node.options && node.options.length > 0) {
7255
7255
  output.push('OPTIONS');
@@ -7264,10 +7264,10 @@ class Deparser {
7264
7264
  AlterForeignServerStmt(node, context) {
7265
7265
  const output = ['ALTER', 'SERVER'];
7266
7266
  if (node.servername) {
7267
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
7267
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.servername));
7268
7268
  }
7269
7269
  if (node.version) {
7270
- output.push('VERSION', quote_utils_1.QuoteUtils.escape(node.version));
7270
+ output.push('VERSION', quotes_1.QuoteUtils.escape(node.version));
7271
7271
  }
7272
7272
  if (node.options && node.options.length > 0) {
7273
7273
  output.push('OPTIONS');
@@ -7289,7 +7289,7 @@ class Deparser {
7289
7289
  }
7290
7290
  output.push('SERVER');
7291
7291
  if (node.servername) {
7292
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
7292
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.servername));
7293
7293
  }
7294
7294
  if (node.options && node.options.length > 0) {
7295
7295
  output.push('OPTIONS');
@@ -7313,14 +7313,14 @@ class Deparser {
7313
7313
  }
7314
7314
  output.push('SERVER');
7315
7315
  if (node.servername) {
7316
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
7316
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.servername));
7317
7317
  }
7318
7318
  return output.join(' ');
7319
7319
  }
7320
7320
  ImportForeignSchemaStmt(node, context) {
7321
7321
  const output = ['IMPORT', 'FOREIGN', 'SCHEMA'];
7322
7322
  if (node.remote_schema) {
7323
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.remote_schema));
7323
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.remote_schema));
7324
7324
  }
7325
7325
  if (node.list_type) {
7326
7326
  switch (node.list_type) {
@@ -7346,11 +7346,11 @@ class Deparser {
7346
7346
  }
7347
7347
  output.push('FROM', 'SERVER');
7348
7348
  if (node.server_name) {
7349
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.server_name));
7349
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.server_name));
7350
7350
  }
7351
7351
  output.push('INTO');
7352
7352
  if (node.local_schema) {
7353
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.local_schema));
7353
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.local_schema));
7354
7354
  }
7355
7355
  if (node.options && node.options.length > 0) {
7356
7356
  const importSchemaContext = context.spawn('ImportForeignSchemaStmt');
@@ -7364,7 +7364,7 @@ class Deparser {
7364
7364
  if (node.relation) {
7365
7365
  output.push(this.RangeVar(node.relation, context));
7366
7366
  if (node.indexname) {
7367
- output.push('USING', quote_utils_1.QuoteUtils.quoteIdentifier(node.indexname));
7367
+ output.push('USING', quotes_1.QuoteUtils.quoteIdentifier(node.indexname));
7368
7368
  }
7369
7369
  }
7370
7370
  if (node.params && node.params.length > 0) {
@@ -7428,7 +7428,7 @@ class Deparser {
7428
7428
  output.push(this.RangeVar(node.relation, context));
7429
7429
  }
7430
7430
  if (node.name) {
7431
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
7431
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
7432
7432
  }
7433
7433
  return output.join(' ');
7434
7434
  }
@@ -7468,7 +7468,7 @@ class Deparser {
7468
7468
  if (!node.dbname) {
7469
7469
  throw new Error('CreatedbStmt requires dbname');
7470
7470
  }
7471
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
7471
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.dbname));
7472
7472
  if (node.options && node.options.length > 0) {
7473
7473
  const options = list_utils_1.ListUtils.unwrapList(node.options)
7474
7474
  .map(option => this.visit(option, context))
@@ -7485,7 +7485,7 @@ class Deparser {
7485
7485
  if (!node.dbname) {
7486
7486
  throw new Error('DropdbStmt requires dbname');
7487
7487
  }
7488
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
7488
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.dbname));
7489
7489
  if (node.options && node.options.length > 0) {
7490
7490
  const options = list_utils_1.ListUtils.unwrapList(node.options)
7491
7491
  .map(option => this.visit(option, context))
@@ -7583,7 +7583,7 @@ class Deparser {
7583
7583
  case 'OBJECT_POLICY':
7584
7584
  output.push('POLICY');
7585
7585
  if (node.subname) {
7586
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
7586
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.subname));
7587
7587
  }
7588
7588
  break;
7589
7589
  case 'OBJECT_PUBLICATION':
@@ -7641,7 +7641,7 @@ class Deparser {
7641
7641
  }
7642
7642
  // Handle OBJECT_RULE special case: rule_name ON table_name format
7643
7643
  if (node.renameType === 'OBJECT_RULE' && node.subname && node.relation) {
7644
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname));
7644
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.subname));
7645
7645
  output.push('ON');
7646
7646
  output.push(this.RangeVar(node.relation, context));
7647
7647
  }
@@ -7660,7 +7660,7 @@ class Deparser {
7660
7660
  if (items.length === 2) {
7661
7661
  const accessMethod = items[0].String?.sval || '';
7662
7662
  const objectName = items[1].String?.sval || '';
7663
- output.push(`${quote_utils_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`);
7663
+ output.push(`${quotes_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`);
7664
7664
  }
7665
7665
  else {
7666
7666
  output.push(this.visit(node.object, context));
@@ -7681,19 +7681,19 @@ class Deparser {
7681
7681
  }
7682
7682
  }
7683
7683
  if (node.renameType === 'OBJECT_COLUMN' && node.subname) {
7684
- output.push('RENAME COLUMN', quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
7684
+ output.push('RENAME COLUMN', quotes_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
7685
7685
  }
7686
7686
  else if (node.renameType === 'OBJECT_DOMCONSTRAINT' && node.subname) {
7687
- output.push('RENAME CONSTRAINT', quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
7687
+ output.push('RENAME CONSTRAINT', quotes_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
7688
7688
  }
7689
7689
  else if (node.renameType === 'OBJECT_TABCONSTRAINT' && node.subname) {
7690
- output.push('RENAME CONSTRAINT', quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
7690
+ output.push('RENAME CONSTRAINT', quotes_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
7691
7691
  }
7692
7692
  else if (node.renameType === 'OBJECT_ATTRIBUTE' && node.subname) {
7693
- output.push('RENAME ATTRIBUTE', quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
7693
+ output.push('RENAME ATTRIBUTE', quotes_1.QuoteUtils.quoteIdentifier(node.subname), 'TO');
7694
7694
  }
7695
7695
  else if (node.renameType === 'OBJECT_ROLE' && node.subname) {
7696
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.subname), 'RENAME TO');
7696
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.subname), 'RENAME TO');
7697
7697
  }
7698
7698
  else if (node.renameType === 'OBJECT_SCHEMA' && node.subname) {
7699
7699
  output.push(this.quoteIfNeeded(node.subname), 'RENAME TO');
@@ -7707,7 +7707,7 @@ class Deparser {
7707
7707
  if (!node.newname) {
7708
7708
  throw new Error('RenameStmt requires newname');
7709
7709
  }
7710
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.newname));
7710
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.newname));
7711
7711
  // Handle CASCADE/RESTRICT behavior for RENAME operations
7712
7712
  if (node.behavior === 'DROP_CASCADE') {
7713
7713
  output.push('CASCADE');
@@ -7730,7 +7730,7 @@ class Deparser {
7730
7730
  if (items.length === 2) {
7731
7731
  const accessMethod = items[0].String?.sval || '';
7732
7732
  const objectName = items[1].String?.sval || '';
7733
- output.push(`${quote_utils_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`);
7733
+ output.push(`${quotes_1.QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`);
7734
7734
  }
7735
7735
  else {
7736
7736
  output.push(this.visit(node.object, context));
@@ -8000,7 +8000,7 @@ class Deparser {
8000
8000
  SecLabelStmt(node, context) {
8001
8001
  const output = ['SECURITY LABEL'];
8002
8002
  if (node.provider) {
8003
- output.push('FOR', quote_utils_1.QuoteUtils.quoteIdentifier(node.provider));
8003
+ output.push('FOR', quotes_1.QuoteUtils.quoteIdentifier(node.provider));
8004
8004
  }
8005
8005
  output.push('ON');
8006
8006
  if (node.objtype) {
@@ -8153,7 +8153,7 @@ class Deparser {
8153
8153
  }
8154
8154
  output.push('LANGUAGE');
8155
8155
  if (node.plname) {
8156
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.plname));
8156
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.plname));
8157
8157
  }
8158
8158
  if (node.plhandler && node.plhandler.length > 0) {
8159
8159
  output.push('HANDLER');
@@ -8189,7 +8189,7 @@ class Deparser {
8189
8189
  }
8190
8190
  output.push('LANGUAGE');
8191
8191
  if (node.lang) {
8192
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.lang));
8192
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.lang));
8193
8193
  }
8194
8194
  output.push('(');
8195
8195
  const transforms = [];
@@ -8217,7 +8217,7 @@ class Deparser {
8217
8217
  }
8218
8218
  output.push('TRIGGER');
8219
8219
  if (node.trigname) {
8220
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.trigname));
8220
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.trigname));
8221
8221
  }
8222
8222
  if (context.isPretty()) {
8223
8223
  const components = [];
@@ -8381,14 +8381,14 @@ class Deparser {
8381
8381
  output.push('OLD TABLE AS');
8382
8382
  }
8383
8383
  if (node.name) {
8384
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
8384
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
8385
8385
  }
8386
8386
  return output.join(' ');
8387
8387
  }
8388
8388
  CreateEventTrigStmt(node, context) {
8389
8389
  const output = ['CREATE EVENT TRIGGER'];
8390
8390
  if (node.trigname) {
8391
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.trigname));
8391
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.trigname));
8392
8392
  }
8393
8393
  output.push('ON');
8394
8394
  if (node.eventname) {
@@ -8414,7 +8414,7 @@ class Deparser {
8414
8414
  AlterEventTrigStmt(node, context) {
8415
8415
  const output = ['ALTER EVENT TRIGGER'];
8416
8416
  if (node.trigname) {
8417
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.trigname));
8417
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.trigname));
8418
8418
  }
8419
8419
  if (node.tgenabled) {
8420
8420
  switch (node.tgenabled) {
@@ -8549,11 +8549,11 @@ class Deparser {
8549
8549
  }
8550
8550
  output.push('ALL', 'IN', 'TABLESPACE');
8551
8551
  if (node.orig_tablespacename) {
8552
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.orig_tablespacename));
8552
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.orig_tablespacename));
8553
8553
  }
8554
8554
  output.push('SET', 'TABLESPACE');
8555
8555
  if (node.new_tablespacename) {
8556
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.new_tablespacename));
8556
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.new_tablespacename));
8557
8557
  }
8558
8558
  if (node.nowait) {
8559
8559
  output.push('NOWAIT');
@@ -8577,10 +8577,10 @@ class Deparser {
8577
8577
  const sequenceName = [];
8578
8578
  const seq = node.sequence;
8579
8579
  if (seq.schemaname) {
8580
- sequenceName.push(quote_utils_1.QuoteUtils.quoteIdentifier(seq.schemaname));
8580
+ sequenceName.push(quotes_1.QuoteUtils.quoteIdentifier(seq.schemaname));
8581
8581
  }
8582
8582
  if (seq.relname) {
8583
- sequenceName.push(quote_utils_1.QuoteUtils.quoteIdentifier(seq.relname));
8583
+ sequenceName.push(quotes_1.QuoteUtils.quoteIdentifier(seq.relname));
8584
8584
  }
8585
8585
  output.push(sequenceName.join('.'));
8586
8586
  }
@@ -8614,10 +8614,10 @@ class Deparser {
8614
8614
  const sequenceName = [];
8615
8615
  const seq = node.sequence;
8616
8616
  if (seq.schemaname) {
8617
- sequenceName.push(quote_utils_1.QuoteUtils.quoteIdentifier(seq.schemaname));
8617
+ sequenceName.push(quotes_1.QuoteUtils.quoteIdentifier(seq.schemaname));
8618
8618
  }
8619
8619
  if (seq.relname) {
8620
- sequenceName.push(quote_utils_1.QuoteUtils.quoteIdentifier(seq.relname));
8620
+ sequenceName.push(quotes_1.QuoteUtils.quoteIdentifier(seq.relname));
8621
8621
  }
8622
8622
  output.push(sequenceName.join('.'));
8623
8623
  }
@@ -8964,7 +8964,7 @@ class Deparser {
8964
8964
  }
8965
8965
  aliasname(node, context) {
8966
8966
  if (typeof node === 'string') {
8967
- return quote_utils_1.QuoteUtils.quoteIdentifier(node);
8967
+ return quotes_1.QuoteUtils.quoteIdentifier(node);
8968
8968
  }
8969
8969
  return this.visit(node, context);
8970
8970
  }
@@ -8996,7 +8996,7 @@ class Deparser {
8996
8996
  const defName = defElem.defname;
8997
8997
  const defValue = defElem.arg;
8998
8998
  if (defName && defValue) {
8999
- const quotedDefName = quote_utils_1.QuoteUtils.quoteIdentifier(defName);
8999
+ const quotedDefName = quotes_1.QuoteUtils.quoteIdentifier(defName);
9000
9000
  const preservedDefName = quotedDefName !== defName ? quotedDefName : this.preserveOperatorDefElemCase(defName);
9001
9001
  if ((defName.toLowerCase() === 'commutator' || defName.toLowerCase() === 'negator') && defValue.List) {
9002
9002
  const listItems = list_utils_1.ListUtils.unwrapList(defValue.List.items);
@@ -9013,7 +9013,7 @@ class Deparser {
9013
9013
  else if (defName && !defValue) {
9014
9014
  // Handle boolean flags like HASHES, MERGES - preserve original case
9015
9015
  if (defName === 'Hashes' || defName === 'Merges') {
9016
- return quote_utils_1.QuoteUtils.quoteIdentifier(defName);
9016
+ return quotes_1.QuoteUtils.quoteIdentifier(defName);
9017
9017
  }
9018
9018
  return this.preserveOperatorDefElemCase(defName).toUpperCase();
9019
9019
  }
@@ -9152,7 +9152,7 @@ class Deparser {
9152
9152
  const defName = defElem.defname;
9153
9153
  const defValue = defElem.arg;
9154
9154
  if (defName && defValue) {
9155
- const quotedDefName = quote_utils_1.QuoteUtils.quoteIdentifier(defName);
9155
+ const quotedDefName = quotes_1.QuoteUtils.quoteIdentifier(defName);
9156
9156
  const preservedDefName = quotedDefName !== defName ? quotedDefName : defName;
9157
9157
  // Handle String arguments with single quotes for string literals
9158
9158
  if (defValue.String) {
@@ -9308,7 +9308,7 @@ class Deparser {
9308
9308
  AlterDatabaseStmt(node, context) {
9309
9309
  const output = ['ALTER', 'DATABASE'];
9310
9310
  if (node.dbname) {
9311
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
9311
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.dbname));
9312
9312
  }
9313
9313
  if (node.options && node.options.length > 0) {
9314
9314
  const options = list_utils_1.ListUtils.unwrapList(node.options).map(opt => this.visit(opt, context));
@@ -9319,7 +9319,7 @@ class Deparser {
9319
9319
  AlterDatabaseRefreshCollStmt(node, context) {
9320
9320
  const output = ['ALTER', 'DATABASE'];
9321
9321
  if (node.dbname) {
9322
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
9322
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.dbname));
9323
9323
  }
9324
9324
  output.push('REFRESH', 'COLLATION', 'VERSION');
9325
9325
  return output.join(' ');
@@ -9327,7 +9327,7 @@ class Deparser {
9327
9327
  AlterDatabaseSetStmt(node, context) {
9328
9328
  const output = ['ALTER', 'DATABASE'];
9329
9329
  if (node.dbname) {
9330
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.dbname));
9330
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.dbname));
9331
9331
  }
9332
9332
  if (node.setstmt) {
9333
9333
  const setClause = this.VariableSetStmt(node.setstmt, context);
@@ -9338,7 +9338,7 @@ class Deparser {
9338
9338
  DeclareCursorStmt(node, context) {
9339
9339
  const output = ['DECLARE'];
9340
9340
  if (node.portalname) {
9341
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.portalname));
9341
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.portalname));
9342
9342
  }
9343
9343
  // Handle cursor options before CURSOR keyword
9344
9344
  const cursorOptions = [];
@@ -9380,7 +9380,7 @@ class Deparser {
9380
9380
  else if (node.pubobjtype === 'PUBLICATIONOBJ_TABLES_IN_SCHEMA') {
9381
9381
  output.push('TABLES IN SCHEMA');
9382
9382
  if (node.name) {
9383
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.name));
9383
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.name));
9384
9384
  }
9385
9385
  }
9386
9386
  else if (node.pubobjtype === 'PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA') {
@@ -9406,7 +9406,7 @@ class Deparser {
9406
9406
  CreateAmStmt(node, context) {
9407
9407
  const output = ['CREATE', 'ACCESS', 'METHOD'];
9408
9408
  if (node.amname) {
9409
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.amname));
9409
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.amname));
9410
9410
  }
9411
9411
  output.push('TYPE');
9412
9412
  switch (node.amtype) {
@@ -9466,7 +9466,7 @@ class Deparser {
9466
9466
  }
9467
9467
  }
9468
9468
  if (node.tableSpaceName) {
9469
- output.push('TABLESPACE', quote_utils_1.QuoteUtils.quoteIdentifier(node.tableSpaceName));
9469
+ output.push('TABLESPACE', quotes_1.QuoteUtils.quoteIdentifier(node.tableSpaceName));
9470
9470
  }
9471
9471
  return output.join(' ');
9472
9472
  }
@@ -9624,7 +9624,7 @@ class Deparser {
9624
9624
  RangeTableFuncCol(node, context) {
9625
9625
  const output = [];
9626
9626
  if (node.colname) {
9627
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.colname));
9627
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.colname));
9628
9628
  }
9629
9629
  if (node.for_ordinality) {
9630
9630
  output.push('FOR ORDINALITY');
@@ -9770,10 +9770,10 @@ class Deparser {
9770
9770
  if (node.op === 'IS_XMLPI') {
9771
9771
  if (node.name && node.args && node.args.length > 0) {
9772
9772
  const argStrs = list_utils_1.ListUtils.unwrapList(node.args).map(arg => this.visit(arg, context));
9773
- return `xmlpi(name ${quote_utils_1.QuoteUtils.quoteIdentifier(node.name)}, ${argStrs.join(', ')})`;
9773
+ return `xmlpi(name ${quotes_1.QuoteUtils.quoteIdentifier(node.name)}, ${argStrs.join(', ')})`;
9774
9774
  }
9775
9775
  else if (node.name) {
9776
- return `xmlpi(name ${quote_utils_1.QuoteUtils.quoteIdentifier(node.name)})`;
9776
+ return `xmlpi(name ${quotes_1.QuoteUtils.quoteIdentifier(node.name)})`;
9777
9777
  }
9778
9778
  else {
9779
9779
  return 'XMLPI()';
@@ -9788,7 +9788,7 @@ class Deparser {
9788
9788
  output.push('XMLELEMENT');
9789
9789
  const elementParts = [];
9790
9790
  if (node.name) {
9791
- elementParts.push(`NAME ${quote_utils_1.QuoteUtils.quoteIdentifier(node.name)}`);
9791
+ elementParts.push(`NAME ${quotes_1.QuoteUtils.quoteIdentifier(node.name)}`);
9792
9792
  }
9793
9793
  if (node.named_args && node.named_args.length > 0) {
9794
9794
  const namedArgStrs = list_utils_1.ListUtils.unwrapList(node.named_args).map(arg => this.visit(arg, context));
@@ -9888,7 +9888,7 @@ class Deparser {
9888
9888
  // Handle name and args for operations that don't have special handling
9889
9889
  if (node.op !== 'IS_XMLELEMENT' && node.op !== 'IS_XMLPARSE' && node.op !== 'IS_XMLROOT' && node.op !== 'IS_DOCUMENT') {
9890
9890
  if (node.name) {
9891
- const quotedName = quote_utils_1.QuoteUtils.quoteIdentifier(node.name);
9891
+ const quotedName = quotes_1.QuoteUtils.quoteIdentifier(node.name);
9892
9892
  output.push(`NAME ${quotedName}`);
9893
9893
  }
9894
9894
  if (node.args && node.args.length > 0) {
@@ -9909,26 +9909,26 @@ class Deparser {
9909
9909
  }
9910
9910
  schemaname(node, context) {
9911
9911
  if (typeof node === 'string') {
9912
- return quote_utils_1.QuoteUtils.quoteIdentifier(node);
9912
+ return quotes_1.QuoteUtils.quoteIdentifier(node);
9913
9913
  }
9914
9914
  if (node && node.String && node.String.sval) {
9915
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.String.sval);
9915
+ return quotes_1.QuoteUtils.quoteIdentifier(node.String.sval);
9916
9916
  }
9917
9917
  // Handle other node types without recursion
9918
9918
  if (node && typeof node === 'object') {
9919
9919
  if (node.sval !== undefined) {
9920
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.sval);
9920
+ return quotes_1.QuoteUtils.quoteIdentifier(node.sval);
9921
9921
  }
9922
9922
  // Handle List nodes that might contain schema names
9923
9923
  if (node.List && Array.isArray(node.List.items)) {
9924
9924
  const items = node.List.items;
9925
9925
  if (items.length > 0 && items[0].String && items[0].String.sval) {
9926
- return quote_utils_1.QuoteUtils.quoteIdentifier(items[0].String.sval);
9926
+ return quotes_1.QuoteUtils.quoteIdentifier(items[0].String.sval);
9927
9927
  }
9928
9928
  }
9929
9929
  // For other complex nodes, try to extract string value without recursion
9930
9930
  if (node.val !== undefined) {
9931
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.val);
9931
+ return quotes_1.QuoteUtils.quoteIdentifier(node.val);
9932
9932
  }
9933
9933
  return '';
9934
9934
  }
@@ -9991,7 +9991,7 @@ class Deparser {
9991
9991
  }
9992
9992
  output.push('RULE');
9993
9993
  if (node.rulename) {
9994
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.rulename));
9994
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.rulename));
9995
9995
  }
9996
9996
  output.push('AS ON');
9997
9997
  if (node.event) {
@@ -10058,42 +10058,42 @@ class Deparser {
10058
10058
  }
10059
10059
  relname(node, context) {
10060
10060
  if (typeof node === 'string') {
10061
- return quote_utils_1.QuoteUtils.quoteIdentifier(node);
10061
+ return quotes_1.QuoteUtils.quoteIdentifier(node);
10062
10062
  }
10063
10063
  if (node && node.String && node.String.sval) {
10064
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.String.sval);
10064
+ return quotes_1.QuoteUtils.quoteIdentifier(node.String.sval);
10065
10065
  }
10066
10066
  if (node && typeof node === 'object' && node.relname) {
10067
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.relname);
10067
+ return quotes_1.QuoteUtils.quoteIdentifier(node.relname);
10068
10068
  }
10069
10069
  return this.visit(node, context);
10070
10070
  }
10071
10071
  rel(node, context) {
10072
10072
  if (typeof node === 'string') {
10073
- return quote_utils_1.QuoteUtils.quoteIdentifier(node);
10073
+ return quotes_1.QuoteUtils.quoteIdentifier(node);
10074
10074
  }
10075
10075
  if (node && node.String && node.String.sval) {
10076
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.String.sval);
10076
+ return quotes_1.QuoteUtils.quoteIdentifier(node.String.sval);
10077
10077
  }
10078
10078
  if (node && node.RangeVar) {
10079
10079
  return this.RangeVar(node.RangeVar, context);
10080
10080
  }
10081
10081
  if (node && typeof node === 'object' && node.relname) {
10082
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.relname);
10082
+ return quotes_1.QuoteUtils.quoteIdentifier(node.relname);
10083
10083
  }
10084
10084
  return this.visit(node, context);
10085
10085
  }
10086
10086
  objname(node, context) {
10087
10087
  if (typeof node === 'string') {
10088
- return quote_utils_1.QuoteUtils.quoteIdentifier(node);
10088
+ return quotes_1.QuoteUtils.quoteIdentifier(node);
10089
10089
  }
10090
10090
  if (node && node.String && node.String.sval) {
10091
- return quote_utils_1.QuoteUtils.quoteIdentifier(node.String.sval);
10091
+ return quotes_1.QuoteUtils.quoteIdentifier(node.String.sval);
10092
10092
  }
10093
10093
  if (Array.isArray(node)) {
10094
10094
  const parts = node.map(part => {
10095
10095
  if (part && part.String && part.String.sval) {
10096
- return quote_utils_1.QuoteUtils.quoteIdentifier(part.String.sval);
10096
+ return quotes_1.QuoteUtils.quoteIdentifier(part.String.sval);
10097
10097
  }
10098
10098
  return this.visit(part, context);
10099
10099
  });
@@ -10164,7 +10164,7 @@ class Deparser {
10164
10164
  CurrentOfExpr(node, context) {
10165
10165
  const output = ['CURRENT OF'];
10166
10166
  if (node.cursor_name) {
10167
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.cursor_name));
10167
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.cursor_name));
10168
10168
  }
10169
10169
  if (node.cursor_param > 0) {
10170
10170
  output.push(`$${node.cursor_param}`);
@@ -10247,7 +10247,7 @@ class Deparser {
10247
10247
  if (items.length === 2) {
10248
10248
  const schemaName = items[0].String?.sval || '';
10249
10249
  const domainName = items[1].String?.sval || '';
10250
- output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, domainName));
10250
+ output.push(quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, domainName));
10251
10251
  }
10252
10252
  else {
10253
10253
  output.push(this.visit(node.object, context));
@@ -10259,7 +10259,7 @@ class Deparser {
10259
10259
  if (items.length === 2) {
10260
10260
  const schemaName = items[0].String?.sval || '';
10261
10261
  const typeName = items[1].String?.sval || '';
10262
- output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, typeName));
10262
+ output.push(quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, typeName));
10263
10263
  }
10264
10264
  else {
10265
10265
  output.push(this.visit(node.object, context));
@@ -10271,7 +10271,7 @@ class Deparser {
10271
10271
  if (items.length === 2) {
10272
10272
  const schemaName = items[0].String?.sval || '';
10273
10273
  const conversionName = items[1].String?.sval || '';
10274
- output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, conversionName));
10274
+ output.push(quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, conversionName));
10275
10275
  }
10276
10276
  else {
10277
10277
  output.push(this.visit(node.object, context));
@@ -10283,7 +10283,7 @@ class Deparser {
10283
10283
  if (items.length === 2) {
10284
10284
  const schemaName = items[0].String?.sval || '';
10285
10285
  const parserName = items[1].String?.sval || '';
10286
- output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, parserName));
10286
+ output.push(quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, parserName));
10287
10287
  }
10288
10288
  else {
10289
10289
  output.push(this.visit(node.object, context));
@@ -10295,7 +10295,7 @@ class Deparser {
10295
10295
  if (items.length === 2) {
10296
10296
  const schemaName = items[0].String?.sval || '';
10297
10297
  const configName = items[1].String?.sval || '';
10298
- output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, configName));
10298
+ output.push(quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, configName));
10299
10299
  }
10300
10300
  else {
10301
10301
  output.push(this.visit(node.object, context));
@@ -10307,7 +10307,7 @@ class Deparser {
10307
10307
  if (items.length === 2) {
10308
10308
  const schemaName = items[0].String?.sval || '';
10309
10309
  const templateName = items[1].String?.sval || '';
10310
- output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, templateName));
10310
+ output.push(quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, templateName));
10311
10311
  }
10312
10312
  else {
10313
10313
  output.push(this.visit(node.object, context));
@@ -10319,7 +10319,7 @@ class Deparser {
10319
10319
  if (items.length === 2) {
10320
10320
  const schemaName = items[0].String?.sval || '';
10321
10321
  const dictionaryName = items[1].String?.sval || '';
10322
- output.push(quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, dictionaryName));
10322
+ output.push(quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, dictionaryName));
10323
10323
  }
10324
10324
  else {
10325
10325
  output.push(this.visit(node.object, context));
@@ -10331,13 +10331,13 @@ class Deparser {
10331
10331
  if (items.length === 2) {
10332
10332
  const accessMethod = items[0].String?.sval || '';
10333
10333
  const opClassName = items[1].String?.sval || '';
10334
- output.push(`${quote_utils_1.QuoteUtils.quoteIdentifier(opClassName)} USING ${accessMethod}`);
10334
+ output.push(`${quotes_1.QuoteUtils.quoteIdentifier(opClassName)} USING ${accessMethod}`);
10335
10335
  }
10336
10336
  else if (items.length === 3) {
10337
10337
  const accessMethod = items[0].String?.sval || '';
10338
10338
  const schemaName = items[1].String?.sval || '';
10339
10339
  const opClassName = items[2].String?.sval || '';
10340
- output.push(`${quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, opClassName)} USING ${accessMethod}`);
10340
+ output.push(`${quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, opClassName)} USING ${accessMethod}`);
10341
10341
  }
10342
10342
  else {
10343
10343
  output.push(this.visit(node.object, context));
@@ -10349,13 +10349,13 @@ class Deparser {
10349
10349
  if (items.length === 2) {
10350
10350
  const accessMethod = items[0].String?.sval || '';
10351
10351
  const opFamilyName = items[1].String?.sval || '';
10352
- output.push(`${quote_utils_1.QuoteUtils.quoteIdentifier(opFamilyName)} USING ${accessMethod}`);
10352
+ output.push(`${quotes_1.QuoteUtils.quoteIdentifier(opFamilyName)} USING ${accessMethod}`);
10353
10353
  }
10354
10354
  else if (items.length === 3) {
10355
10355
  const accessMethod = items[0].String?.sval || '';
10356
10356
  const schemaName = items[1].String?.sval || '';
10357
10357
  const opFamilyName = items[2].String?.sval || '';
10358
- output.push(`${quote_utils_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, opFamilyName)} USING ${accessMethod}`);
10358
+ output.push(`${quotes_1.QuoteUtils.quoteQualifiedIdentifier(schemaName, opFamilyName)} USING ${accessMethod}`);
10359
10359
  }
10360
10360
  else {
10361
10361
  output.push(this.visit(node.object, context));
@@ -10367,7 +10367,7 @@ class Deparser {
10367
10367
  }
10368
10368
  output.push('SET SCHEMA');
10369
10369
  if (node.newschema) {
10370
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.newschema));
10370
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.newschema));
10371
10371
  }
10372
10372
  return output.join(' ');
10373
10373
  }
@@ -10436,7 +10436,7 @@ class Deparser {
10436
10436
  }
10437
10437
  if (node.servername) {
10438
10438
  output.push('SERVER');
10439
- output.push(quote_utils_1.QuoteUtils.quoteIdentifier(node.servername));
10439
+ output.push(quotes_1.QuoteUtils.quoteIdentifier(node.servername));
10440
10440
  }
10441
10441
  if (node.options && node.options.length > 0) {
10442
10442
  const foreignTableContext = context.spawn('CreateForeignTableStmt');