```
CREATE TABLE t (x UInt8, PROJECTION p (SELECT x GROUP BY x)) ENGINE = MergeTree ORDER BY ();
INSERT INTO t VALUES (0);

SET group_by_overflow_mode = 'any', max_rows_to_group_by = 1000, totals_mode = 'after_having_auto';
SELECT x FROM t GROUP BY x WITH TOTALS;
```
{
    /**
     * Remove old (configured by setting) broken detached parts.
     * Only parts with certain prefixes are removed. These prefixes
     * are such that it is guaranteed that they will never be needed
     * and need to be cleared. ctime is used to check when file was
     * moved to detached/ directory (see https://unix.stackexchange.com/a/211134)
     */
    DetachedPartsInfo detached_parts = getDetachedParts();
    if (detached_parts.empty())
        return 0;
    PartsTemporaryRename renamed_parts(*this, "detached/");
    for (const auto & part_info : detached_parts)
    {