The list of all the queries

Do not register duration

Query goal: Find columns of base and foreign tables that based on the column name and type are used to register duration (including the age).
Notes about the query: The query considers both column names in English and Estonian.
Query type: Problem detection (Each row in the result could represent a flaw in the design)
Query reliability: Medium (Medium number of false-positive results)
Query license: MIT License
Fixing suggestion: Instead of registering duration register the point in time when the existence of an entity started and possibly the point in time when the existence of the entity ended. Based on this it is always possible to calculate the duration (age) of the entity.
Data source: INFORMATION_SCHEMA only
SQL query: Click on query to copy it

SELECT table_type, table_schema, table_name, column_name,  data_type, character_maximum_length
FROM INFORMATION_SCHEMA.columns INNER JOIN INFORMATION_SCHEMA.tables USING (table_schema, table_name)
WHERE data_type~*'(char|text|integer|smallint|bigint|numeric|decimal|real|float|double precision)'
AND column_name~*'(^|_)(age|duration|vanus|kestus)$'
AND table_type IN( 'BASE TABLE','FOREIGN') 
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)
ORDER BY table_type, table_schema, table_name, ordinal_position;

Collections where the query belongs to

Collection nameCollection description
Find problems about base tablesA 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 automaticallyQueries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not .

Categories where the query belongs to

Category nameCategory description
Result quality depends on namesQueries of this category use names (for instance, column names) to try to guess the meaning of a database object. Thus, the goodness of names determines the number of false positive and false negative results.
Structure of base tablesQueries of this category provide information about the structuring of base tables at the database conceptual level

Reference materials for further reading

Reference
Factor, P.: SQL Code Smells. Redgate, http://assets.red-gate.com/community/books/sql-code-smells.pdf, last accessed 2019/12/29 (Storing a duration rather than a point in time)

The list of all the queries