dolthub / dolthub/dolt

Preserve case sensitivity in table schema

Open
#5,614 0 comments 0 reactions 1 assignee Claimed by @zachmu View on GitHub
correctness sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

MySQL and Dolt differ in their preservation of case in the definition of schema:

MySQL:
```sql
mysql> create table t (a int default (now()));
Query OK, 0 rows affected (0.01 sec)

mysql> show create table t;
+-------+-----------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`a` int DEFAULT (now())
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+-------+-----------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
Dolt
```sql
dolt> create table t (a int default (now()));
dolt> show create table t;
+-------+------------------------------------------------------------------+
| Table | Create Table |
+-------+------------------------------------------------------------------+
| t | CREATE TABLE `t` ( |
| | `a` int DEFAULT (NOW()) |
| | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin |
+-------+------------------------------------------------------------------+
1 row in set (0.00 sec)
```

Note that `now()` is presenting as `NOW()`

Related: https://github.com/dolthub/dolt/pull/5602

And Capture from discussion with @zachmu :

_preserving case is not always easy, because there are multiple places in the parsing / analysis process where things get normalized functions are especially bad about this
the parser normalizes some of them, and then the analyzer does so again when it resolves a function name to its implementing class
you lose the original case in 2 places sometimes
fixing it everywhere is probably a big lift, but should be the longer term goal_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.