aio-libs / aio-libs/aiomysql

TestOldIssues.test_issue_8 fails

Open
#338 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
1.9k
Forks
272
PR merge metrics
No merged PRs in 30d

Description

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
```

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.