pingcap / pingcap/tidb

When `ERROR_FOR_DIVISION_BY_ZERO` not set, we still get a warning when dividing zero

Open
#50,031 1 comment 0 reactions 1 assignee Claimed by @lcwangchao View on GitHub
severity/minor sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```mysql
-- strict but ERROR_FOR_DIVISION_BY_ZERO not set
> set @@sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION';
> select 1/0;
> show warnings;
```

### 2. What did you expect to see? (Required)

Should be no warning

In MySQL:

```
mysql> select 1/0;
+------+
| 1/0 |
+------+
| NULL |
+------+
1 row in set (0.00 sec)

mysql> show warnings;
Empty set (0.01 sec)
```

### 3. What did you see instead (Required)

```
mysql> select 1/0;
+------+
| 1/0 |
+------+
| NULL |
+------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+---------------+
| Level | Code | Message |
+---------+------+---------------+
| Warning | 1365 | Division by 0 |
+---------+------+---------------+
1 row in set (0.00 sec)
```

### 4. What is your TiDB version? (Required)

master

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.