Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion src/lib/PostgresMetaTables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export default class PostgresMetaTables {
if (id) {
const idsFilter = filterByValue([id])
const sql = generateEnrichedTablesSql({
schemaFilter,
includeColumns: true,
idsFilter,
})
Expand Down
19 changes: 18 additions & 1 deletion test/lib/tables.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from 'vitest'
import { pgMeta } from './utils'
import { pgMeta, TEST_CONNECTION_STRING } from './utils'
Comment thread
avallete marked this conversation as resolved.
Outdated

const cleanNondet = (x: any) => {
const {
Expand Down Expand Up @@ -544,6 +544,23 @@ test('primary keys', async () => {
await pgMeta.tables.remove(res.data!.id)
})

test('retrieve table in non-public schema by id', async () => {
// Create a custom schema and table
await pgMeta.query('CREATE SCHEMA IF NOT EXISTS test_schema')
const createRes = await pgMeta.tables.create({ name: 'test_nonpublic', schema: 'test_schema' })
const tableId = createRes.data!.id

// Retrieve by ID (without specifying schema)
const res = await pgMeta.tables.retrieve({ id: tableId })
expect(res.error).toBeNull()
expect(res.data!.name).toBe('test_nonpublic')
expect(res.data!.schema).toBe('test_schema')

// Cleanup
await pgMeta.tables.remove(tableId)
await pgMeta.query('DROP SCHEMA test_schema')
})

test('composite primary keys preserve order', async () => {
let res = await pgMeta.tables.create({ name: 't_pk_order' })
await pgMeta.columns.create({ table_id: res.data!.id, name: 'col_a', type: 'int8' })
Expand Down