Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set correct 'table_schema' in information_schema.tables #436

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/schema/information-schema/table-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class TablesSchema extends ReadOnlyTable implements _ITable {
}
const ret = {
table_catalog: 'pgmem',
table_schema: 'public',
table_schema: t.ownerSchema.name || 'public',
table_name: t.name,
table_type: 'BASE TABLE',
self_referencing_column_name: null,
Expand Down
6 changes: 6 additions & 0 deletions src/tests/simple-queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ describe('Simple queries', () => {
.toEqual([{ hasuserstable: 0 }]);
})

it('can select info tables with table schema', () => {
none(`create schema custom_schema;
create table custom_schema.test(id text);`)
expect(many(`select table_name from information_schema.tables where table_name = 'test' and table_schema = 'custom_schema';`))
.toEqual([{ table_name: 'test' }]);
});

it('can select info columns', () => {
simpleDb();
Expand Down