This message was deleted.
# secoda-support
w
This message was deleted.
e
Do you know if the user you have connected to Secoda has permission to view these tables? I know in the past @victorious-computer-74029 ran into this issue and he had to give permission to the Secoda user which resolved it.
s
As an admin, I don’t see the tables, so I should have permissions to see all tables no?
e
I’m talking specifically about permissions in Postgres. We run this query behind the scenes, and I imagine it’s not getting picked up with the Postgres user in Secoda.
Copy code
SELECT 
          current_database() AS cluster,
          c.table_schema AS schema,
          c.table_name AS name,
          pgtd.description AS description,
          c.column_name AS col_name,
          c.data_type AS col_type,
          pgcd.description AS col_description,
          c.ordinal_position AS col_sort_order,
          t.table_type = 'VIEW' as is_view,
          fks.reference_tbl,
          fks.reference_col,
          pks.column_name as pk_column_name
        FROM information_schema.columns c
        LEFT JOIN pg_catalog.pg_statio_all_tables st 
          ON c.table_schema = st.schemaname 
          AND c.table_name = st.relname
        LEFT JOIN pg_catalog.pg_description pgtd
          ON pgtd.objoid = st.relid 
          AND pgtd.objsubid = 0
        LEFT JOIN pg_catalog.pg_description pgcd
          ON pgcd.objoid=st.relid 
          AND pgcd.objsubid = c.ordinal_position
        LEFT JOIN information_schema.tables t
          ON t.table_schema = c.table_schema 
          AND t.table_name = c.table_name
        LEFT JOIN (
          SELECT 
            kcu.table_schema,
            kcu.table_name,
            kcu.column_name
          FROM information_schema.table_constraints tco
          JOIN information_schema.key_column_usage kcu 
            ON kcu.constraint_schema = tco.constraint_schema
            AND kcu.constraint_name = tco.constraint_name
          WHERE tco.constraint_type = 'PRIMARY KEY'
          ORDER BY 
            kcu.table_schema,
            kcu.table_name
        ) AS pks
          ON pks.table_schema = c.table_schema
          AND pks.table_name = c.table_name
          AND pks.column_name = c.column_name
        LEFT JOIN (
          SELECT 
            kcu.table_schema, 
            kcu.table_name,
            kcu.column_name,
            rel_kcu.table_name AS reference_tbl,
            rel_kcu.column_name AS reference_col
          FROM information_schema.table_constraints tco
          JOIN information_schema.key_column_usage kcu
            ON kcu.constraint_schema = tco.constraint_schema
            AND kcu.constraint_name = tco.constraint_name
          JOIN information_schema.referential_constraints rco
            ON rco.constraint_schema = tco.constraint_schema
            AND rco.constraint_name = tco.constraint_name
          JOIN information_schema.key_column_usage rel_kcu
            ON  rel_kcu.constraint_schema = rco.unique_constraint_schema
            AND rel_kcu.constraint_name = rco.unique_constraint_name
            AND rel_kcu.ordinal_position = kcu.ordinal_position
          WHERE tco.constraint_type = 'FOREIGN KEY'
          ORDER BY 
            kcu.table_schema,
            kcu.table_name
        ) AS fks
        ON fks.table_schema = c.table_schema
        AND fks.table_name = c.table_name
        AND fks.column_name = c.column_name
        ORDER by cluster, schema, name, col_sort_order;
👍 1
s
Problem solved, it was on our side, thanks a lot for your help 🙂