ClickHouse / ClickHouse/ClickHouse

Different behavior with dividing by 0 for Decimal and other types.

Open
#67,038 0 comments 1 reaction 0 assignees View on GitHub
comp-decimal external potential bug
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

**How to reproduce**
```
SELECT 1 / 0
┌─divide(1, 0)─┐
1. │ inf │
└──────────────┘
```

```
SELECT 1::Decimal(32, 18) / 0
Received exception:
Code: 153. DB::Exception: Division by zero: In scope SELECT CAST('1', 'Decimal(32, 18)') / 0. (ILLEGAL_DIVISION)
```

Clickhouse version: 24.7.1.2514

Example in fiddle:
https://fiddle.clickhouse.com/0cc20bd1-846b-4c1c-afbe-2933a0527cff

**Expected behavior**

Behavior must be equal. I think instead of error must be `inf`

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.