v.20.3Improvement

Fix Error Handling for Long Queries in ClickHouse

Fix wrong error for long queries. It was possible to get syntax error other than Max query size exceeded for correct query. #13928 (Nikolai Kochetov).
Fixed incorrect error reporting for long queries to ensure that the Max query size exceeded error is returned correctly instead of a syntax error.

Why it matters

Previously, users running long queries could receive misleading syntax errors instead of the proper Max query size exceeded error, causing confusion. This fix ensures accurate error messaging for queries exceeding the maximum allowed size, improving debugging and user experience.

How to use it

No action is required from users; the fix is applied automatically. Queries exceeding the maximum size will now correctly trigger the Max query size exceeded error instead of syntax errors.