ClickHouse / ClickHouse/ClickHouse

Compare Date in string format with a Date format doesn't work

Open
#83,622 1 comment 0 reactions 0 assignees View on GitHub
comp-mysql external unexpected behaviour
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

### Company or project name

BYS Solutions

### Describe the unexpected behaviour

Compare Date in string format with a Date format seems doesn't work in the new version of clickhouse 25.3.3.42

### Which ClickHouse versions are affected?

25.3.3.42

### How to reproduce

Previous Version of clickhouse : 23.10.3.5
New version of clickhouse : 25.3.3.42

With the previous version of clickhouse this below query returned data :
```
SELECT stay_date,
FROM mysql('*****')
WHERE (stay_date >= toDate('2025-05-25'))
AND (stay_date <= toDate('2025-07-09'))
AND (id_unit_id = toUInt32(1))
```
On the new version nothing

To fix it I just added toDate(stay_date). Seems more logic too.
But I don't understand something why when I do :

```
SELECT stay_date,
((toDate(stay_date) >= toDate('2025-05-25'))
AND (toDate(stay_date) <= toDate('2025-07-09'))
AND (id_unit_id = toUInt32(1))) as value
FROM mysql(******)
WHERE ((toDate(stay_date) >= toDate('2025-05-25'))
AND (toDate(stay_date) <= toDate('2025-07-09'))
AND (id_unit_id = toUInt32(1)))
```

I have value = 1 ?

Image

### Expected behavior

I should have value = 0
If I have 1 why this condition in the WHERE return nothing data.

### Error message and/or stacktrace

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.