v.21.6Improvement

Fix infinite loop issue with self-referential ClickHouse dictionary configuration

Fix the case when it was possible to configure dictionary with clickhouse source that was looking to itself that leads to infinite loop. Closes #14314. #22479 (Maksim Kita).
Fixed an issue where dictionaries configured with a ClickHouse source that referenced themselves caused an infinite loop.

Why it matters

This fix prevents the system from entering an infinite loop when a dictionary with a ClickHouse source tries to query itself, improving stability and preventing potential crashes or hanging queries.

How to use it

No special action is required by users. After upgrading to the fixed version, self-referencing dictionary sources with ClickHouse will be safely handled to avoid infinite loops.