mchades commented on issue #5721:
URL: https://github.com/apache/gravitino/issues/5721#issuecomment-2510924841
I have experimented with this in MySQL, and this behavior aligns with the
standards of MySQL.
```sql
mysql> CREATE TABLE t1 (
-> c1 INT NULL AUTO_INCREMENT,
-> PRIMARY KEY (c1)
-> );
ERROR 1171 (42000): All parts of a PRIMARY KEY must be NOT NULL; if you need
NULL in a key, use UNIQUE instead
mysql> CREATE TABLE t1 (
-> c1 INT NULL AUTO_INCREMENT,
-> UNIQUE KEY (c1)
-> );
Query OK, 0 rows affected (0.06 sec)
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| t1 |
| view1 |
+----------------+
2 rows in set (0.00 sec)
mysql> desc t1;
+-------+------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+----------------+
| c1 | int | NO | PRI | NULL | auto_increment |
+-------+------+------+-----+---------+----------------+
1 row in set (0.02 sec)
mysql> show create table t1;
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table
|
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
| t1 | CREATE TABLE `t1` (
`c1` int NOT NULL AUTO_INCREMENT,
UNIQUE KEY `c1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
```
But I think we should throw an error at creating a table through Gravitino
as you mentioned
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]