SELECT Count(*) FILTER (WHERE data_type~*'(char|text)') AS nr_of_textual_columns,
Count(*) FILTER (WHERE data_type~*'(smallint|integer|bigint)') AS nr_of_integer_columns,
Count(*) FILTER (WHERE data_type~*'(numeric|decimal)') AS nr_of_decimal_columns,
Count(*) FILTER (WHERE data_type~*'(float|real|double)') AS nr_of_float_columns,
Count(*) FILTER (WHERE data_type~*'(date|timestamp|interval)') AS nr_of_temporal_columns,
Count(*) FILTER (WHERE data_type='boolean') AS nr_of_boolean_columns
FROM INFORMATION_SCHEMA.columns
WHERE (table_schema, table_name) IN (SELECT table_schema, table_name
FROM INFORMATION_SCHEMA.tables WHERE table_type='BASE TABLE')
AND table_schema NOT IN (SELECT schema_name
FROM INFORMATION_SCHEMA.schemata
WHERE schema_name<>'public' AND
schema_owner='postgres' AND schema_name IS NOT NULL);
Collections
This query belongs to the following collections:
Name
Description
Find problems about base tables
A selection of queries that return information about the data types, field sizes, default values as well as general structure of base tables. Contains all the types of queries - problem detection, software measure, and general overview
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 .
Find quick numeric overview of the database
Queries that return numeric values showing mostly the number of different types of database objects in the database
Categories
This query is classified under the following categories:
Name
Description
Data types
Queries of this category provide information about the data types and their usage.