Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

year column type does not round-trip when column value is 0 #4742

Closed
druvv opened this issue Nov 10, 2022 · 3 comments
Closed

year column type does not round-trip when column value is 0 #4742

druvv opened this issue Nov 10, 2022 · 3 comments
Assignees
Labels
bug Something isn't working new format Issues related specifically to the __DOLT__ storage format

Comments

@druvv
Copy link
Contributor

druvv commented Nov 10, 2022

MySQL behavior:

mysql> create table t (pk int primary key, col1 year);
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t values (1, 0);
Query OK, 1 row affected (0.02 sec)

mysql> select * from t;
+----+------+
| pk | col1 |
+----+------+
|  1 | 0000 |
+----+------+
1 row in set (0.01 sec)

Dolt:

# Welcome to the DoltSQL shell.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
new_format> create table t (pk int primary key, col1 year);
new_format> insert into t values (1, 0);
Query OK, 1 row affected (0.00 sec)
new_format>  select * from t;
+----+------+
| pk | col1 |
+----+------+
| 1  | 2048 |
+----+------+
1 row in set (0.01 sec)

The 2048 value is confusing.

@druvv druvv added bug Something isn't working new format Issues related specifically to the __DOLT__ storage format labels Nov 10, 2022
@druvv druvv self-assigned this Nov 10, 2022
@druvv
Copy link
Contributor Author

druvv commented Nov 10, 2022

Found this while adding tests for a previous table import bug where truncated column values were causing panics

@druvv
Copy link
Contributor Author

druvv commented Nov 10, 2022

MySQL displays YEAR values in YYYY format, with a range of 1901 to 2155, and 0000.

Will fix.

@druvv
Copy link
Contributor Author

druvv commented Nov 11, 2022

Fixed in dolthub/go-mysql-server#1395

@druvv druvv closed this as completed Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new format Issues related specifically to the __DOLT__ storage format
Projects
None yet
Development

No branches or pull requests

1 participant