Skip to content

Commit b666212

Browse files
committed
refactor: use quoteQualifiedIdentifier for schema.name patterns
Replaced 11 instances of manual schema.name concatenation with quoteQualifiedIdentifier() for cleaner, more maintainable code: - RangeVar: schema.table patterns - DropStmt: operator class/family with schema - AlterObjectSchemaStmt: domain, type, conversion, parser, config, template, dictionary, operator class/family patterns Co-Authored-By: Dan Lynch <[email protected]>
1 parent b85dacf commit b666212

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/deparser/src/deparser.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ export class Deparser implements DeparserVisitor {
20222022
}
20232023
tableName += '.' + QuoteUtils.quoteIdentifier(node.relname);
20242024
} else if (node.schemaname) {
2025-
tableName = QuoteUtils.quoteIdentifier(node.schemaname) + '.' + QuoteUtils.quoteIdentifier(node.relname);
2025+
tableName = QuoteUtils.quoteQualifiedIdentifier(node.schemaname, node.relname);
20262026
} else {
20272027
tableName = QuoteUtils.quoteIdentifier(node.relname);
20282028
}
@@ -4563,7 +4563,7 @@ export class Deparser implements DeparserVisitor {
45634563
const accessMethod = items[0];
45644564
const schemaName = items[1];
45654565
const objectName = items[2];
4566-
return `${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(objectName)} USING ${accessMethod}`;
4566+
return `${QuoteUtils.quoteQualifiedIdentifier(schemaName, objectName)} USING ${accessMethod}`;
45674567
}
45684568
return items.join('.');
45694569
}
@@ -11217,7 +11217,7 @@ export class Deparser implements DeparserVisitor {
1121711217
if (items.length === 2) {
1121811218
const schemaName = items[0].String?.sval || '';
1121911219
const domainName = items[1].String?.sval || '';
11220-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(domainName)}`);
11220+
output.push(QuoteUtils.quoteQualifiedIdentifier(schemaName, domainName));
1122111221
} else {
1122211222
output.push(this.visit(node.object as any, context));
1122311223
}
@@ -11227,7 +11227,7 @@ export class Deparser implements DeparserVisitor {
1122711227
if (items.length === 2) {
1122811228
const schemaName = items[0].String?.sval || '';
1122911229
const typeName = items[1].String?.sval || '';
11230-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(typeName)}`);
11230+
output.push(QuoteUtils.quoteQualifiedIdentifier(schemaName, typeName));
1123111231
} else {
1123211232
output.push(this.visit(node.object as any, context));
1123311233
}
@@ -11237,7 +11237,7 @@ export class Deparser implements DeparserVisitor {
1123711237
if (items.length === 2) {
1123811238
const schemaName = items[0].String?.sval || '';
1123911239
const conversionName = items[1].String?.sval || '';
11240-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(conversionName)}`);
11240+
output.push(QuoteUtils.quoteQualifiedIdentifier(schemaName, conversionName));
1124111241
} else {
1124211242
output.push(this.visit(node.object as any, context));
1124311243
}
@@ -11247,7 +11247,7 @@ export class Deparser implements DeparserVisitor {
1124711247
if (items.length === 2) {
1124811248
const schemaName = items[0].String?.sval || '';
1124911249
const parserName = items[1].String?.sval || '';
11250-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(parserName)}`);
11250+
output.push(QuoteUtils.quoteQualifiedIdentifier(schemaName, parserName));
1125111251
} else {
1125211252
output.push(this.visit(node.object as any, context));
1125311253
}
@@ -11257,7 +11257,7 @@ export class Deparser implements DeparserVisitor {
1125711257
if (items.length === 2) {
1125811258
const schemaName = items[0].String?.sval || '';
1125911259
const configName = items[1].String?.sval || '';
11260-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(configName)}`);
11260+
output.push(QuoteUtils.quoteQualifiedIdentifier(schemaName, configName));
1126111261
} else {
1126211262
output.push(this.visit(node.object as any, context));
1126311263
}
@@ -11267,7 +11267,7 @@ export class Deparser implements DeparserVisitor {
1126711267
if (items.length === 2) {
1126811268
const schemaName = items[0].String?.sval || '';
1126911269
const templateName = items[1].String?.sval || '';
11270-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(templateName)}`);
11270+
output.push(QuoteUtils.quoteQualifiedIdentifier(schemaName, templateName));
1127111271
} else {
1127211272
output.push(this.visit(node.object as any, context));
1127311273
}
@@ -11277,7 +11277,7 @@ export class Deparser implements DeparserVisitor {
1127711277
if (items.length === 2) {
1127811278
const schemaName = items[0].String?.sval || '';
1127911279
const dictionaryName = items[1].String?.sval || '';
11280-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(dictionaryName)}`);
11280+
output.push(QuoteUtils.quoteQualifiedIdentifier(schemaName, dictionaryName));
1128111281
} else {
1128211282
output.push(this.visit(node.object as any, context));
1128311283
}
@@ -11292,7 +11292,7 @@ export class Deparser implements DeparserVisitor {
1129211292
const accessMethod = items[0].String?.sval || '';
1129311293
const schemaName = items[1].String?.sval || '';
1129411294
const opClassName = items[2].String?.sval || '';
11295-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(opClassName)} USING ${accessMethod}`);
11295+
output.push(`${QuoteUtils.quoteQualifiedIdentifier(schemaName, opClassName)} USING ${accessMethod}`);
1129611296
} else {
1129711297
output.push(this.visit(node.object as any, context));
1129811298
}
@@ -11307,7 +11307,7 @@ export class Deparser implements DeparserVisitor {
1130711307
const accessMethod = items[0].String?.sval || '';
1130811308
const schemaName = items[1].String?.sval || '';
1130911309
const opFamilyName = items[2].String?.sval || '';
11310-
output.push(`${QuoteUtils.quoteIdentifier(schemaName)}.${QuoteUtils.quoteIdentifier(opFamilyName)} USING ${accessMethod}`);
11310+
output.push(`${QuoteUtils.quoteQualifiedIdentifier(schemaName, opFamilyName)} USING ${accessMethod}`);
1131111311
} else {
1131211312
output.push(this.visit(node.object as any, context));
1131311313
}

0 commit comments

Comments
 (0)