| 156 | |
| 157 | |
| 158 | static bool queryHasWithClause(const IAST * ast) |
| 159 | { |
| 160 | if (const auto * select = dynamic_cast<const ASTSelectQuery *>(ast); select && select->with()) |
| 161 | { |
| 162 | return true; |
| 163 | } |
| 164 | |
| 165 | // This full recursive walk is somewhat excessive, because most of the |
| 166 | // children are not queries, but on the other hand it will let us to avoid |
| 167 | // breakage when the AST structure changes and some new variant of query |
| 168 | // nesting is added. This function is used in fuzzer, so it's better to be |
| 169 | // defensive and avoid weird unexpected errors. |
| 170 | // clang-tidy is confused by this function: it thinks that if `select` is |
| 171 | // nullptr, `ast` is also nullptr, and complains about nullptr dereference. |
| 172 | // NOLINTNEXTLINE |
| 173 | for (const auto & child : ast->children) |
| 174 | { |
| 175 | if (queryHasWithClause(child.get())) |
| 176 | { |
| 177 | return true; |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | return false; |
| 182 | } |
| 183 | |
| 184 | |
| 185 | class Client : public Poco::Util::Application |
no test coverage detected