The list of all the queries

Columns with tsvector type

Query goal: Find columns of base tables and materialized views that have tsvector type.
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'
END AS table_type, 
attname AS column_name,
coalesce(domain_type.typname, pg_type.typname) AS data_type
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
INNER JOIN pg_type ON pg_attribute.atttypid =pg_type.oid
LEFT JOIN pg_type AS domain_type ON domain_type.oid=pg_type.typbasetype
WHERE attnum>=1 
AND relkind IN ('r','m')
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)),
text_search_cols AS (SELECT table_schema, table_name, table_type, array_agg(column_name::text) AS column_name
FROM columns
WHERE data_type IN ('tsvector')
GROUP BY  table_schema, table_name, table_type)
SELECT table_schema, table_name, table_type, column_name
FROM text_search_cols
ORDER BY table_schema, table_name, table_type;

Collections where the query belongs to

Collection nameCollection description
Find problems by overviewQueries 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 .

Categories where the query belongs to

Category nameCategory description
Data typesQueries of this category provide information about the data types and their usage.
Full text searchQueries of this category provide information about full text search

The list of all the queries