github / github/gh-ost

BUG (?) wrong data type in JSON data after alter table .

Open
#813 4 comments 0 reactions 1 assignee Claimed by @timvaillancourt View on GitHub
bug
Dominant language
Go
Stars
13.6k
Forks
1.4k
Avg merge
2h 31m
Merged PRs (30d)
4

Description

we are facing an issue after an alter of a JSON column.
after the alter completed we found wrong data types in the JSON data:

* data after the alter :
```sql
oot@localhost(mysql-0a.96):[gallery]> select date_updated,JSON_EXTRACT(metadata, '$.photoMetadata.focalPoint.x') from gallery.items_v2 where gallery_id = '61482ce3-9431-407c-8bc7-ad7408e1ff38';
+---------------------+--------------------------------------------------------+
| date_updated | JSON_EXTRACT(metadata, '$.photoMetadata.focalPoint.x') |
+---------------------+--------------------------------------------------------+
| 2019-12-20 13:14:14 | "0.5" |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:46 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
+---------------------+--------------------------------------------------------+
14 rows in set (0.00 sec)

```
* where befor the alter the data was (this is from snapshot of the database befor the alter table )
```sql
(tbd-mysql.42) [gallery]> select date_updated,JSON_EXTRACT(metadata, '$.photoMetadata.focalPoint.x') from gallery.items_v2 where gallery_id = '61482ce3-9431-407c-8bc7-ad7408e1ff38';
+---------------------+--------------------------------------------------------+
| date_updated | JSON_EXTRACT(metadata, '$.photoMetadata.focalPoint.x') |
+---------------------+--------------------------------------------------------+
| 2019-12-20 13:14:14 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:46 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
| 2019-12-20 13:12:45 | 0.5 |
+---------------------+--------------------------------------------------------+
14 rows in set (0.17 sec)
````
* As you can see the FLOAT in the JSON converted into STRING
* versions :
```
> select @@version
-> ;
+------------+
| @@version |
+------------+
| 5.7.20-log |
+------------+
1 row in set (0.00 sec)
```
```bash
:~ # gh-ost --version
1.0.48
```
Thanks

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.