Filter Queries
Found 12 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.
#1. Comments of columns
system catalog base tables onlyFind all comments of columns of tables.
#2. Comments of derived tables
system catalog base tables onlyFind comments of derived tables (views and materialized views) that are registered in the system catalog witht a COMMENT statement. Find also comments on their associated objects (columns, triggers, rules). Make sure that the comments give relevant, useful, and correct information.
#3. Comments of non-derived tables
system catalog base tables onlyFind comments of non-derived tables (base tables, foreign tables, and partitioned tables) that are registered in the system catalog witht a COMMENT statement. Find also comments on their associated objects (columns, constraints, indexes, triggers, rules). Make sure that the comments give relevant, useful, and correct information.
#4. Comments of routines
INFORMATION_SCHEMA+system catalog base tablesFind comments of user-defined routines (functions or procedures) that are registered in the system catalog witht a COMMENT statement. Make sure that the comments give relevant, useful, and correct information.
#5. Comments of schemas, sequences, types, domains, domain constraints, and event triggers
system catalog base tables onlyFind all the comments that have been added with a COMMENT statement to schemas, sequences, types, domains, and event triggers.
#6. Consistency of comments of routines
INFORMATION_SCHEMA+system catalog base tablesFind user-defined routines that have a comment registered by the COMMENT statement and a comment within the routine body. Make sure that there are no inconsistencies between the comments.
#7. Duplicate comments
INFORMATION_SCHEMA+system catalog base tablesFind comments that have been registered with a COMMENT statement and that are associated with more than one object. It would probably mean that a comment is incorrect or missing.
#8. Something is still to do in routines
INFORMATION_SCHEMA+system catalog base tablesFind routines where comments contain TODO phrase.
#9. The number of commented routines
INFORMATION_SCHEMA+system catalog base tablesFind the number of commented routines based on the way how the comments have been added (as a COMMENT object or as a comment in the routine body).
#10. The reference to a database operation is missing from a comment
INFORMATION_SCHEMA+system catalog base tablesThis query audits the metadata of user-defined routines to enforce traceability between the implementation and the design specifications. It identifies routines whose comments lack a standardized reference to the specific database operation contract they implement. The query checks for the absence of a required identifier pattern, typically formatted as OP followed by a number (e.g., OP1, OP12). Enforcing this standard ensures that every routine can be mapped back to its originating requirement or business rule.
#11. Too short or missing comments of derived tables and routines
INFORMATION_SCHEMA+system catalog base tablesFind views, materialized views, and user-defined routines that do not have a comment at all or the comment is shorter than twice the length of the object name, or the comment states that it is missing (TODO). You should give information to future developers and maintainers of the system (including the future version of yourself). Do not just repeat the name in the comment (with perhaps some rewording).
#12. Trigger function comments implying operation implementation rather than validation
INFORMATION_SCHEMA+system catalog base tablesThis query performs a semantic analysis of trigger function comments to identify potential violations of separation of concerns. It flags triggers whose documentation references explicit database operations (e.g., OP1, OP2) but lacks terminology associated with validation or invariant enforcement (e.g., "check", "ensure", "validate"). This linguistic pattern suggests that the trigger may be improperly implementing the business operation itself (a side effect) rather than serving its primary role as an integrity guardrail, or that the documentation inaccurately reflects the trigger's behavior.
| # | Name (sorted ascending) | Goal | Type | Data source | Last update | License | Actions |
|---|---|---|---|---|---|---|---|
| 1 | Comments of columns | Find all comments of columns of tables. | General | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 2 | Comments of derived tables | Find comments of derived tables (views and materialized views) that are registered in the system catalog witht a COMMENT statement. Find also comments on their associated objects (columns, triggers, rules). Make sure that the comments give relevant, useful, and correct information. | General | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 3 | Comments of non-derived tables | Find comments of non-derived tables (base tables, foreign tables, and partitioned tables) that are registered in the system catalog witht a COMMENT statement. Find also comments on their associated objects (columns, constraints, indexes, triggers, rules). Make sure that the comments give relevant, useful, and correct information. | General | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 4 | Comments of routines | Find comments of user-defined routines (functions or procedures) that are registered in the system catalog witht a COMMENT statement. Make sure that the comments give relevant, useful, and correct information. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 5 | Comments of schemas, sequences, types, domains, domain constraints, and event triggers | Find all the comments that have been added with a COMMENT statement to schemas, sequences, types, domains, and event triggers. | General | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 6 | Consistency of comments of routines | Find user-defined routines that have a comment registered by the COMMENT statement and a comment within the routine body. Make sure that there are no inconsistencies between the comments. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 7 | Duplicate comments | Find comments that have been registered with a COMMENT statement and that are associated with more than one object. It would probably mean that a comment is incorrect or missing. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 8 | Something is still to do in routines | Find routines where comments contain TODO phrase. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 9 | The number of commented routines | Find the number of commented routines based on the way how the comments have been added (as a COMMENT object or as a comment in the routine body). | Sofware measure | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 10 | The reference to a database operation is missing from a comment | This query audits the metadata of user-defined routines to enforce traceability between the implementation and the design specifications. It identifies routines whose comments lack a standardized reference to the specific database operation contract they implement. The query checks for the absence of a required identifier pattern, typically formatted as OP followed by a number (e.g., OP1, OP12). Enforcing this standard ensures that every routine can be mapped back to its originating requirement or business rule. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 11 | Too short or missing comments of derived tables and routines | Find views, materialized views, and user-defined routines that do not have a comment at all or the comment is shorter than twice the length of the object name, or the comment states that it is missing (TODO). You should give information to future developers and maintainers of the system (including the future version of yourself). Do not just repeat the name in the comment (with perhaps some rewording). | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 12 | Trigger function comments implying operation implementation rather than validation | This query performs a semantic analysis of trigger function comments to identify potential violations of separation of concerns. It flags triggers whose documentation references explicit database operations (e.g., OP1, OP2) but lacks terminology associated with validation or invariant enforcement (e.g., "check", "ensure", "validate"). This linguistic pattern suggests that the trigger may be improperly implementing the business operation itself (a side effect) rather than serving its primary role as an integrity guardrail, or that the documentation inaccurately reflects the trigger's behavior. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) |