github / github/gh-ost

Incorrect values when making column nullable

Open
#691 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
13.6k
Forks
1.4k
Avg merge
2h 31m
Merged PRs (30d)
4

Description

Confirmed: #684 (related issue: #681 ) did not fix this problem.

Using gh-ost to make a column to be nullable results in incorrect values for the column.
Initial guess is an overflow issue of some sort.

Reproduction steps:
```sql
CREATE TABLE ghost_overflow_test (primary_key BIGINT(20) NOT NULL,
test_id BIGINT(20) NOT NULL,
PRIMARY KEY (primary_key));
INSERT INTO ghost_overflow_test VALUES (1,18446744073709551615);
```
```bash
./gh-ost --host=localhost --user=test --password=test --database=test \
--allow-on-master --alter="CHANGE test_id test_id bigint(20);" \
--table=ghost_overflow_test --execute
```
```sql
select * from ghost_overflow_test;
+-------------+---------------------+
| primary_key | test_id |
+-------------+---------------------+
| 1 | 9223372036854775807 |
+-------------+---------------------+
1 row in set (0.00 sec)
```

id went from 18446744073709551615 -> 9223372036854775807

Versions:
```bash
$ mysql --version
mysql Ver 14.14 Distrib 5.7.11, for Linux (x86_64) using EditLine wrapper
$ go version
go version go1.9.2 linux/amd64
```
tested on gh-ost master branch and test-decimal branch

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.