Skip to content

Commit 0e8d4fc

Browse files
committed
updates for #127
1 parent 9639d81 commit 0e8d4fc

File tree

5 files changed

+13
-197
lines changed

5 files changed

+13
-197
lines changed

CLI.md

Lines changed: 0 additions & 195 deletions
This file was deleted.

__fixtures__/generated/generated.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21095,6 +21095,7 @@
2109521095
"misc/issues-9.sql": "CREATE TABLE \"Album\"\n(\n \"AlbumId\" INT NOT NULL,\n \"Title\" VARCHAR(160) NOT NULL,\n \"ArtistId\" INT NOT NULL,\n CONSTRAINT \"PK_Album\" PRIMARY KEY (\"AlbumId\")\n)",
2109621096
"misc/issues-10.sql": "CREATE INDEX \"existing_undispatched_message\" ON public.messages USING btree (\"context_id\", context_type, notification_name, \"to\", user_id)",
2109721097
"misc/issues-11.sql": "COMMENT ON COLUMN \"foo\".\"whatever\" IS $$\nSomething blah, this data may have chars like '\\n' and '\\r' in it.\n$$",
21098+
"misc/issues-12.sql": "SELECT * from foo.bar.baz",
2109821099
"misc/inflection-1.sql": "CREATE SCHEMA inflection",
2109921100
"misc/inflection-2.sql": "GRANT USAGE ON SCHEMA inflection TO PUBLIC",
2110021101
"misc/inflection-3.sql": "ALTER DEFAULT PRIVILEGES IN SCHEMA inflection \n GRANT EXECUTE ON FUNCTIONS TO PUBLIC",

__fixtures__/kitchen-sink/misc/issues.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ CREATE INDEX "existing_undispatched_message" ON public.messages USING btree ("co
5454
COMMENT ON COLUMN "foo"."whatever" IS $$
5555
Something blah, this data may have chars like '\n' and '\r' in it.
5656
$$;
57+
58+
-- https://github.com/launchql/pgsql-parser/issues/127
59+
SELECT * from foo.bar.baz;

packages/deparser/__tests__/kitchen-sink/misc-issues.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ it('misc-issues', async () => {
1414
"misc/issues-8.sql",
1515
"misc/issues-9.sql",
1616
"misc/issues-10.sql",
17-
"misc/issues-11.sql"
17+
"misc/issues-11.sql",
18+
"misc/issues-12.sql"
1819
]);
1920
});

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)