Skip to content

Commit

Permalink
set correct table_schema on info tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodolfo-Solaro committed Jan 2, 2025
1 parent 3462581 commit 8844c5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 8844c5b

Please sign in to comment.