Filter Queries

Found 1031 queries.

  • All the queries about database objects contain a subcondition to exclude from the result information about the system catalog.
  • Although the statements use SQL constructs (common table expressions; NOT in subqueries) that could cause performance problems in case of large datasets it shouldn't be a problem in case of relatively small amount of data, which is in the system catalog of a database.
  • Statistics about the catalog content and project home in GitHub that has additional information.

# Name Goal Type Data source Last update License
981 Updating or deleting data in a routine without restricting rows Find user-defined routines that contain UPDATE or DELETE statement but do not contain any WHERE clause, meaning that at least one UPDATE or DELETE operation influences all the rows of a table. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
982 Usage of base tables Find for each derived table the list of base tables that are used by the derived table. General INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
983 Usage of the non-standard now() function This query identifies all expressions that use the non-standard now() function. In PostgreSQL, now() is a historical, non-standard alias for the SQL-standard current_timestamp. While they are functionally identical within PostgreSQL (both returning the transaction start timestamp as a TIMESTAMPTZ), the use of current_timestamp is strongly preferred for reasons of code portability and adherence to standards. Standardizing on current_timestamp ensures the code is universally understood and easier to maintain or migrate to other database systems. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-15 10:01 MIT License View
984 Used indexes Find indexes that are used by the DBMS. General INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
985 Use invocation of a precise function instead of casting in a default value expression Be precise and write as little code as possible. Prefer expressions with simple invocations of functions like localtimestamp, current_timestamp, and current_date over expressions like (now())::date. Find table columns that have a default value that casts the type of the returned value of a non-deterministic function (now, localtimestamp, current_timestamp, and current_date). Problem detection INFORMATION_SCHEMA only 2025-11-07 10:11 MIT License View
986 Useless trivial non-trigger functions This query identifies user-defined routines (excluding triggers) that are functionally trivial. It flags routines whose body consists solely of returning a static value: either an input argument (identity function), a constant literal, or NULL. Such routines typically perform no computation, data manipulation, or side effects. They are likely placeholders, deprecated logic, or artifacts of incomplete refactoring, and should be reviewed for removal or implementation. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-12-05 11:44 MIT License View
987 Useless trivial trigger functions This query identifies trigger functions that are functionally trivial, specifically those whose sole action is to execute RETURN NEW. In a BEFORE trigger context, this operation simply allows the data modification to proceed unchanged. If the function contains no other logic (e.g., validation, modification of NEW, or side effects), it performs no useful work and incurs unnecessary execution overhead. Such triggers are likely incomplete placeholders or obsolete code that should be removed. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-12-05 11:50 MIT License View
988 Useless type indication Find columns and parameters where the type of the identifier is perhaps explicitly indicated in the name. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
989 Useless type indication (2) Find columns and parameters where the type of the identifier is perhaps explicitly indicated in the name. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
990 User-defined composite types Find composite types that are created by a user, i.e., the type is not created automatically by the database management system based on a relation. General system catalog base tables only 2025-11-07 10:11 MIT License View
991 User-defined derived tables Find user-defined views and materialized views. Pay attention to the outer join operations. One should use these if and only if there is a real need for them. Otherwise they just reduce performance. On the other hand, pay attention that outer join is used where it is logically needed. General INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
992 User-defined non-trigger routines without parameters Find user-defined non-trigger routines with no parameters. General INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
993 User-defined non-trigger SQL and PL/pgSQL routines This query retrieves a comprehensive list of user-defined routines (functions and procedures) written in SQL or PL/pgSQL. It explicitly filters the result set to exclude:

  • Trigger functions: Routines intended solely for use in triggers are omitted to focus on callable business logic.
  • System schemas: Routines located in system-managed namespaces (e.g., pg_catalog, information_schema) are excluded to isolate user-created code.
  • Extension routines.

The result provides an inventory of the application's explicit, callable database logic.
General INFORMATION_SCHEMA+system catalog base tables 2025-11-30 08:41 MIT License View
994 User-defined routine execution privilege has been granted to PUBLIC You should follow the principle of least privilege and thus not have in your database user-defined routines that execution privilege is granted to PUBLIC, i.e., to all the database users now and in the future. By default, PostgreSQL gives routine execution privileges to PUBLIC. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
995 User-defined routines that have the same name as some system-defined routine. Avoid creating user-defined routines that have the same name as some system-defined routine because it may cause confusion. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
996 User-defined routines that implement UPSERT operation Find user-defioned routines that implement UPSERT operation. Make sure that it is consistent with the contracts of database operations. General INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
997 User-defined routines that produce a temporary table Find user user-defined routines that produce a temporary table General INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
998 User-defined routines that read data Find user-defined routines that contain SELECT … FROM or PERFORM … FROM operations. PostgreSQL uses multiversion concurrency control (MVCC). Therefore, SELECTs do not block modifications and vice versa. One has to take steps to achieve correct behaviour of data access code. In addition, one should not ask data with multiple queries if it is possible to achieve the result with only one query. General INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
999 User-defined routines that use dynamic SQL to execute data manipulation statements Find user-defined routines that use dynamic SQL to execute data manipulation statements (SELECT, INSERT, UPDATE, DELETE). Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
1000 User-defined routines that use keyword DECLARE but do not declare anything Find user-defined routines that use keyword DECLARE but do not declare anything. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View