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
11 changes: 11 additions & 0 deletions src/connectors/__tests__/postgres.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ class PostgreSQLIntegrationTest extends IntegrationTestBase<PostgreSQLTestContai
ON CONFLICT DO NOTHING
`, {});

// Create a view with a comment (for view comment test)
await connector.executeSQL(`
CREATE OR REPLACE VIEW active_users AS SELECT id, name, email FROM users WHERE age >= 25
`, {});
await connector.executeSQL(`COMMENT ON VIEW active_users IS 'Users aged 25 or older'`, {});

// Create test stored procedures using SQL language to avoid dollar quoting
await connector.executeSQL(`
CREATE OR REPLACE FUNCTION get_user_count()
Expand Down Expand Up @@ -245,6 +251,11 @@ describe('PostgreSQL Connector Integration Tests', () => {
expect(result.rows[0].array_val).toBeDefined();
});

it('should return comment for views via getTableComment', async () => {
const comment = await postgresTest.connector.getTableComment!('active_users');
expect(comment).toBe('Users aged 25 or older');
});

it('should handle PostgreSQL returning clause', async () => {
const result = await postgresTest.connector.executeSQL(
"INSERT INTO users (name, email, age) VALUES ('Returning Test', 'returning@example.com', 40) RETURNING id, name",
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/postgres/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export class PostgresConnector implements Connector {
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname = $1
AND n.nspname = $2
AND c.relkind IN ('r','p','m','f')
AND c.relkind IN ('r','p','m','f','v')
`,
Comment on lines 382 to 386
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change expands getTableComment() to include ordinary views (relkind='v'), but there’s no test asserting that a COMMENT ON VIEW is surfaced (either via getTableComment('view_name') or through search_objects detail output). Since integration tests already cover table comments, please add a corresponding view comment case to prevent regressions.

Copilot uses AI. Check for mistakes.
[tableName, schemaToUse]
);
Expand Down
Loading