MDL-62619 privacy: Prevent action when boolean queries are involved
commita300c3479de70710433047d10a77beae64941d5f
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 9 Aug 2018 14:05:55 +0000 (9 16:05 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 9 Aug 2018 14:12:58 +0000 (9 16:12 +0200)
tree7a35b85c5a2f1410c7894ff6d25390bdd9d3e399
parent38174e03de39d4e6fd690e05f94af265cec0037e
MDL-62619 privacy: Prevent action when boolean queries are involved

Before the patch, queries like:

SELECT 1 FROM dual UNION SELECT 2 FROM dual

were failing badly, with everything but the first numeric element
being ignored by the optimization.

So, being conservative, now we reduce the query being analysed,
ignoring any subquery, inline view (anything within parenthesis
in general) and, in the remaining query, if a boolean query (UNION,
MINUS, INTERSECT...) is found, we don't apply any optimization.
privacy/classes/local/request/contextlist.php
privacy/tests/contextlist_test.php