| Goal | This query identifies DELETE trigger routines that raise an exception and explicitly specify a column in the error context (using the COLUMN clause). This is generally a logical mismatch, as a DELETE operation affects an entire row rather than individual columns. Providing a column-specific error context in this scenario often indicates a copy-paste error from an INSERT or UPDATE trigger. |
|---|---|
| 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) |
| Data Source | INFORMATION_SCHEMA+system catalog |
| SQL Query |
|
Fixing Suggestion
To resolve this issue, remove the COLUMN clause from the error context of the RAISE EXCEPTION statement. Since a DELETE operation affects the entire row, referencing an individual column is misleading and should be omitted.
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:
Triggers and rules
Queries of this category provide information about triggers and rules in a database.
| Name | Description |
|---|---|
| Triggers and rules | Queries of this category provide information about triggers and rules in a database. |
Further reading and related materials: