Skip to content

Commit cddcb0f

Browse files
Fix catalogname handling in RangeVar for three-part table names
- Add catalogname support to RangeVar deparser method - Handle catalog.schema.table format properly in SQL output - Fix misc/issues-7.sql test: 'SELECT * from foo.bar.baz' now correctly includes catalogname - All 254/254 tests now passing (100%) - Update TESTS.md to reflect catalogname support Co-Authored-By: Dan Lynch <[email protected]>
1 parent ffe335d commit cddcb0f

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

TESTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
**254/254 tests passing (100%)**
66

7-
All deparser tests are now passing successfully, including the PostgreSQL 17 features:
8-
- GENERATED BY DEFAULT AS IDENTITY columns
9-
- UNIQUE NULLS NOT DISTINCT constraints
7+
All deparser tests are now passing successfully, including:
8+
- PostgreSQL 17 features (GENERATED BY DEFAULT AS IDENTITY columns, UNIQUE NULLS NOT DISTINCT constraints)
9+
- Three-part table names with catalogname support (catalog.schema.table)
1010

11-
The deparser has been updated to properly handle these new PostgreSQL 17 syntax features.
11+
The deparser has been updated to properly handle catalogname in RangeVar nodes for SQL statements like "SELECT * FROM foo.bar.baz".

packages/deparser/src/deparser.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,13 @@ export class Deparser implements DeparserVisitor {
15771577
}
15781578

15791579
let tableName = '';
1580-
if (node.schemaname) {
1580+
if (node.catalogname) {
1581+
tableName = QuoteUtils.quote(node.catalogname);
1582+
if (node.schemaname) {
1583+
tableName += '.' + QuoteUtils.quote(node.schemaname);
1584+
}
1585+
tableName += '.' + QuoteUtils.quote(node.relname);
1586+
} else if (node.schemaname) {
15811587
tableName = QuoteUtils.quote(node.schemaname) + '.' + QuoteUtils.quote(node.relname);
15821588
} else {
15831589
tableName = QuoteUtils.quote(node.relname);

0 commit comments

Comments
 (0)