Skip to content

Commit

Permalink
Improve error message when required constraint missing. (osquery#8358)
Browse files Browse the repository at this point in the history
Previous message: `constraint failed`

New message (example with `SELECT * FROM hash`): `Table hash was queried without a required column in the WHERE clause`
  • Loading branch information
zwass authored Jul 2, 2024
1 parent ca14540 commit b46d969
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions osquery/sql/virtual_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,9 +972,11 @@ static int xFilter(sqlite3_vtab_cursor* pVtabCursor,
<< " table returns data based on the current user by default, "
"consider JOINing against the users table";
} else if (!required_satisfied) {
LOG(WARNING)
<< "Table " << pVtab->content->name
std::ostringstream out;
out << "Table " << pVtab->content->name
<< " was queried without a required column in the WHERE clause";
LOG(WARNING) << out.str();
setTableErrorMessage(&pVtab->base, out.str());
} else if (!events_satisfied) {
LOG(WARNING) << "Table " << pVtab->content->name
<< " is event-based but events are disabled";
Expand Down

0 comments on commit b46d969

Please sign in to comment.