v.23.9Improvement

Query Cache Error for Non-Deterministic Functions Enhances User Clarity

The query cache now returns an error if the user tries to cache the result of a query with a non-deterministic function such as now, randomString and dictGet. Compared to the previous behavior (silently don't cache the result), this reduces confusion and surprise for users. #54801 (Robert Schulze).
The query cache now raises an error when attempting to cache the result of queries that use non-deterministic functions like now, randomString, or dictGet.

Why it matters

This feature prevents silent failures where results of queries with non-deterministic functions were not cached without any notification. By returning an explicit error, it reduces user confusion and ensures that caching behavior is clear and predictable.

How to use it

Users do not need to enable any new settings. When using the query cache, if the query contains non-deterministic functions, ClickHouse will automatically return an error instead of caching the result silently.