1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Disallow some of the query invariant tests on SQL statements that contain

a GROUP BY since output terms that are no covered by the GROUP BY are
indeterminant.

FossilOrigin-Name: 28ba1fec4519e7ca9466f1a2f787c905f2cf880d38a004639f99f948e46a51e7
This commit is contained in:
drh
2022-12-16 18:32:07 +00:00
parent e9f740e484
commit a9d18d83fc
3 changed files with 13 additions and 18 deletions

View File

@ -136,16 +136,11 @@ int fuzz_invariant(
}
sqlite3_finalize(pCk);
if( sqlite3_strlike("%group%by%order%by%desc%",sqlite3_sql(pStmt),0)==0 ){
/* dbsqlfuzz crash-647c162051c9b23ce091b7bbbe5125ce5f00e922
** Original statement is:
**
** SELECT a,c,d,b,'' FROM t1 GROUP BY 1 HAVING d<>345 ORDER BY a DESC;
**
** The values of c, d, and b are indeterminate and change when the
** enclosed in the test query because the DESC is dropped.
**
** SELECT * FROM (...) WHERE "a"==0
if( sqlite3_strlike("%group%by%",sqlite3_sql(pStmt),0)==0 ){
/*
** If there is a GROUP BY clause, it might not cover every term in the
** output. And then non-covered terms can take on a value from any
** row in the result set. This can cause differing answers.
*/
goto not_a_fault;
}