ClickHouse / ClickHouse/ClickHouse
Enum value can be queried by its underlying numeric value (written as text)
Open
comp-datatype-wrapper
unexpected behaviour
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
**Describe the unexpected behaviour**
```sql
SELECT version()
┌─version()─┐
│ 23.8.9.54 │
└───────────┘
create table e (value Enum('hello', 'world')) ENGINE = Log; -- OK
insert into e values('hello'); -- OK
-- Query 'hello' by its underlying numeric value
select value from e where value = '1' -- BAD: it should have failed probably
┌─value─┐
│ hello │
└───────┘
-- value IN ('1') also works
select value from e where value = '3' -- OK: this one fails
```
**Expected behavior**
I would expect `value = '1'` or `value IN ('1')` to fail with "Unknown element error".
Contributor guide
Assessment
This issue has not been assessed yet.