| Goal | This query performs a quantity-based assessment of the database's procedural logic. It verifies whether the schema meets a minimum complexity requirement by counting the number of user-defined, non-trigger routines (functions and procedures). The check passes only if the count is equal to or greater than the threshold of 4. This metric is used to ensure a baseline level of backend logic implementation. |
|---|---|
| Notes | This query implements a requirement that might occur in a learning situation. The condition in the query ensures that if the requirement is not fulfilled, then the query returns one row, otherwise it does not return a row. The result is achieved by using a PostgreSQL feature that permits SELECT statements without the FROM clause. The number of routines (four in this case) serves here as an example. It could be replaced with some other threshold. The query does not consider the routines that are a part of an extension. |
| Type | Problem detection Each row in the result could represent a flaw in the design |
| Reliability | High Few or no false-positive results |
| License | MIT (opens in new tab) |
| Fixing Suggestion | Create additional routines. |
| Data Source | INFORMATION_SCHEMA+system catalog |
| SQL Query |
|
Collections
This query belongs to the following collections:
Find problems automatically
Queries, 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 .
| Name | Description |
|---|---|
| Find problems automatically | Queries, 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
This query is classified under the following categories:
Assessment
Queries of this category could be used specifically in the learning environment to assess as to whether student projects have filled certain criteria.
User-defined routines
Queries of this category provide information about the user-defined routines
| Name | Description |
|---|---|
| Assessment | Queries of this category could be used specifically in the learning environment to assess as to whether student projects have filled certain criteria. |
| User-defined routines | Queries of this category provide information about the user-defined routines |