Query goal: | Find names of columns of base tables, views, and materialized views that contain passwords. Make sure that the naming is consistent, |
Query type: | General (Overview of some aspect of the database.) |
Query license: | MIT License |
Data source: | INFORMATION_SCHEMA+system catalog |
SQL query: | Click on query to copy it
WITH columns AS (SELECT nspname AS table_schema, relname AS table_name, CASE WHEN relkind='r' THEN 'BASE TABLE' WHEN relkind='m' THEN 'MATERIALIZED VIEW' ELSE 'VIEW' END AS table_type, attname AS column_name FROM pg_class INNER JOIN pg_namespace ON pg_class.relnamespace=pg_namespace.oid INNER JOIN pg_attribute ON pg_class.oid=pg_attribute.attrelid WHERE relkind IN ('r', 'm','v') AND attnum>=1 AND nspname NOT IN (SELECT schema_name FROM INFORMATION_SCHEMA.schemata WHERE schema_name<>'public' AND schema_owner='postgres' AND schema_name IS NOT NULL)) SELECT table_schema, table_name, table_type, column_name FROM columns WHERE column_name~'(passw|psw|pw|parool|salas)' ORDER BY table_schema, table_name, column_name; |
Collection name | Collection description |
---|---|
Find problems by overview | Queries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not . |
Category name | Category description |
---|---|
Inconsistencies | Queries of this catergory provide information about inconsistencies of solving the same problem in different places. |
Naming | Queries of this category provide information about the style of naming. |