Skip to content

Postgres tables with column-level select GRANTs not showing #7676

@antony-chaostheory

Description

@antony-chaostheory

Issue Summary

When browsing a Postgres data source, tables that have column-level select GRANTs are not being displayed because the table-level select GRANT is revoked.

Steps to Reproduce

  1. Revoke a table from SELECT
  2. Grant SELECT to certain columns
  3. Can query the table if you enter the SQL manually, but the table does not exist in the object browser.

Technical details:

  • Redash Version: 26.3.0
  • Browser/OS: N/A
  • How did you install Redash: N/A

Solution:

Update get_tables to check column privilege in redash/query_runner/pg.py:

        AND (
            has_table_privilege(quote_ident(s.nspname) || '.' || quote_ident(c.relname), 'select')
            OR has_column_privilege(quote_ident(s.nspname) || '.' || quote_ident(c.relname) , a.attname, 'select')
        )
        AND (
            has_table_privilege(quote_ident(table_schema) || '.' || quote_ident(table_name), 'select')
            OR has_column_privilege(quote_ident(table_schema) || '.' || quote_ident(table_name), column_name, 'select')
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions