Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 0 additions & 195 deletions CLI.md

This file was deleted.

1 change: 1 addition & 0 deletions __fixtures__/generated/generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -21095,6 +21095,7 @@
"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)",
"misc/issues-10.sql": "CREATE INDEX \"existing_undispatched_message\" ON public.messages USING btree (\"context_id\", context_type, notification_name, \"to\", user_id)",
"misc/issues-11.sql": "COMMENT ON COLUMN \"foo\".\"whatever\" IS $$\nSomething blah, this data may have chars like '\\n' and '\\r' in it.\n$$",
"misc/issues-12.sql": "SELECT * from foo.bar.baz",
"misc/inflection-1.sql": "CREATE SCHEMA inflection",
"misc/inflection-2.sql": "GRANT USAGE ON SCHEMA inflection TO PUBLIC",
"misc/inflection-3.sql": "ALTER DEFAULT PRIVILEGES IN SCHEMA inflection \n GRANT EXECUTE ON FUNCTIONS TO PUBLIC",
Expand Down
3 changes: 3 additions & 0 deletions __fixtures__/kitchen-sink/misc/issues.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ CREATE INDEX "existing_undispatched_message" ON public.messages USING btree ("co
COMMENT ON COLUMN "foo"."whatever" IS $$
Something blah, this data may have chars like '\n' and '\r' in it.
$$;

-- https://github.com/launchql/pgsql-parser/issues/127
SELECT * from foo.bar.baz;
3 changes: 2 additions & 1 deletion packages/deparser/__tests__/kitchen-sink/misc-issues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ it('misc-issues', async () => {
"misc/issues-8.sql",
"misc/issues-9.sql",
"misc/issues-10.sql",
"misc/issues-11.sql"
"misc/issues-11.sql",
"misc/issues-12.sql"
]);
});
8 changes: 7 additions & 1 deletion packages/deparser/src/deparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,13 @@ export class Deparser implements DeparserVisitor {
}

let tableName = '';
if (node.schemaname) {
if (node.catalogname) {
tableName = QuoteUtils.quote(node.catalogname);
if (node.schemaname) {
tableName += '.' + QuoteUtils.quote(node.schemaname);
}
tableName += '.' + QuoteUtils.quote(node.relname);
} else if (node.schemaname) {
tableName = QuoteUtils.quote(node.schemaname) + '.' + QuoteUtils.quote(node.relname);
} else {
tableName = QuoteUtils.quote(node.relname);
Expand Down