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

Dolt doesn't update last_insert_id() when DEFAULT is used #7565

Open
fulghum opened this issue Mar 4, 2024 · 0 comments
Open

Dolt doesn't update last_insert_id() when DEFAULT is used #7565

fulghum opened this issue Mar 4, 2024 · 0 comments
Labels
bug Something isn't working correctness We don't return the same result as MySQL

Comments

@fulghum
Copy link
Contributor

fulghum commented Mar 4, 2024

In MySQL, when the DEFAULT value is used to insert into an auto_increment column, the last insert auto increment value is recorded and accessible through last_insert_id(). Dolt does not currently detect this as an auto_increment insert.

MySQL Behavior

mysql> create table t (pk int auto_increment primary key);
Query OK, 0 rows affected (0.01 sec)

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

mysql> select last_insert_id();
+------------------+
| last_insert_id() |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

Dolt Behavior

mar4/main> create table t (pk int auto_increment primary key);
mar4/main*> insert into t values (DEFAULT);
Query OK, 1 row affected (0.00 sec)
mar4/main*> select last_insert_id();
+------------------+
| last_insert_id() |
+------------------+
| 0                |
+------------------+
1 row in set (0.00 sec)
@fulghum fulghum added bug Something isn't working correctness We don't return the same result as MySQL labels Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness We don't return the same result as MySQL
Projects
None yet
Development

No branches or pull requests

1 participant