diff --git a/src/connectors/__tests__/postgres.integration.test.ts b/src/connectors/__tests__/postgres.integration.test.ts index 73261618..debbcfcd 100644 --- a/src/connectors/__tests__/postgres.integration.test.ts +++ b/src/connectors/__tests__/postgres.integration.test.ts @@ -167,6 +167,12 @@ class PostgreSQLIntegrationTest extends IntegrationTestBase= 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() @@ -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", diff --git a/src/connectors/postgres/index.ts b/src/connectors/postgres/index.ts index 6ba0f6da..6507ea92 100644 --- a/src/connectors/postgres/index.ts +++ b/src/connectors/postgres/index.ts @@ -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') `, [tableName, schemaToUse] );