Skip to content

Views and materialized Views not displayed in schema page #498

@coorasse

Description

@coorasse

I noticed that the schema page (/queries/schema) does not display the views and materialized views, which is a pity in my opinion.
Here is the query we use to get those in Postgres:

SELECT n.nspname AS table_schema,
       c.relname AS table_name,
       a.attname AS column_name,
       pg_catalog.format_type(a.atttypid, a.atttypmod) AS data_type,
       a.attnum AS ordinal_position,
       pg_catalog.col_description(c.oid, a.attnum) AS column_comment
FROM pg_catalog.pg_attribute a
JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE c.relkind IN ('r', 'v', 'm')
      AND a.attnum > 0
      AND NOT a.attisdropped
      AND n.nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY table_schema, table_name, ordinal_position

If you are interested @ankane , I can open a PR for the sql_adapter to run this postgres.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions