aio-libs / aio-libs/aiomysql

TestOldIssues.test_issue_8 fails

未關閉
#338 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Python
星號
1.9k
分支
272
PR 合併指標
30 天內沒有已合併 PR

描述

On Ubuntu 18.04.1 LTS, python 3.6.5 building from master (67b01a89), TestOldIssues.test_issue_8 fails.

```
$ mysql --version
mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using EditLine wrapper
$ mysqld --version
mysqld Ver 5.7.23-0ubuntu0.18.04.1 for Linux on x86_64 ((Ubuntu))
```

The specific failure is `pymysql.err.InternalError: (1067, "Invalid default value for 'dh'")`

This failure reproduces if I attempt to manually construct the table being constructed in test_issue_8:
```
mysql> CREATE TABLE `test` (
-> `station` int(10) NOT NULL DEFAULT '0',
-> `dh` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
-> `echeance` int(1) NOT NULL DEFAULT '0', `me` double DEFAULT NULL,
-> `mo` double DEFAULT NULL, PRIMARY
-> KEY (`station`,`dh`,`echeance`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ERROR 1067 (42000): Invalid default value for 'dh'
```

I believe the problem is that recent version of MySQL have changed the default `sql_mode`:
```
mysql> SELECT @@sql_mode\G
*************************** 1. row ***************************
@@sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
```

Specifically `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` appear to be the problem.

Edit:
In case it wasn't clear, all of the rest of the tests passed:
```
...
Results (208.56s):
490 passed
1 failed
- tests/test_issues.py:71 TestOldIssues.test_issue_8
4 xfailed
16 skipped
Makefile:10: recipe for target 'test' failed
make: *** [test] Error 1
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。