db: better diagnostics when a query fails.
What changed, and why it matters
This commit changes an error message when a database query fails. Previously the program reported where the query came from and the SQL text; now it reports the actual database error message. There is no security fix here—only improved diagnostic logging for developers and operators.
No security action required. Treat as normal maintenance/diagnostics improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In db/utils.c, db_query_prepared() calls db_fatal() on failure. The old format string included stmt->location and stmt->query->query but omitted stmt->error. The new format string prints stmt->error instead. This is a straightforward logging/diagnostics improvement with no change to query handling, error paths, or trust boundaries.
Changed components
db/utils.cdb_query_prepared()Inspect captured patch +1 / −2
diff --git a/db/utils.c b/db/utils.c
index b73fda39..70389907 100644
--- a/db/utils.c
+++ b/db/utils.c
@@ -153,8 +153,7 @@ bool db_query_prepared_canfail(struct db_stmt *stmt)
void db_query_prepared(struct db_stmt *stmt)
{
if (!db_query_prepared_canfail(stmt))
- db_fatal(stmt->db, "query failed: %s: %s",
- stmt->location, stmt->query->query);
+ db_fatal(stmt->db, "query failed: %s", stmt->error);
}
bool db_step(struct db_stmt *stmt)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.