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

Indefinitely errors in SQL shell once a UNIQUE constraint has been violated #1079

Closed
Hydrocharged opened this issue Dec 6, 2020 · 0 comments · Fixed by #1080
Closed

Indefinitely errors in SQL shell once a UNIQUE constraint has been violated #1079

Hydrocharged opened this issue Dec 6, 2020 · 0 comments · Fixed by #1080
Assignees
Labels
bug Something isn't working

Comments

@Hydrocharged
Copy link
Contributor

When using the SQL shell, if there is a UNIQUE constraint that is violated due to an INSERT, the table continues to fail for all future writes.

Repro:

$ dolt init
Successfully initialized dolt data repository.
$ dolt sql
# Welcome to the DoltSQL shell.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
doltplay> CREATE TABLE person(
        ->   id INT NOT NULL PRIMARY KEY,
        ->   whole_name VARCHAR(50) UNIQUE,
        ->   age INT
        -> );
doltplay> INSERT INTO person(id, whole_name, age) VALUES 
        ->   (1, 'John Smith', 31),
        ->   (2, 'Jane Cooper', 42),
        ->   (3, 'Kate Lee', 25),
        ->   (4, 'Andrew Black', 37);
Query OK, 4 rows affected
doltplay> INSERT INTO person(id, whole_name, age) VALUES (5, 'tutu', 45);
Query OK, 1 row affected
doltplay> SELECT * FROM person;
+----+--------------+-----+
| id | whole_name   | age |
+----+--------------+-----+
| 1  | John Smith   | 31  |
| 2  | Jane Cooper  | 42  |
| 3  | Kate Lee     | 25  |
| 4  | Andrew Black | 37  |
| 5  | tutu         | 45  |
+----+--------------+-----+
doltplay> INSERT INTO person(id, whole_name, age) VALUES (6, 'tutu', 56);
Query OK, 1 row affected
failed to update indexes
doltplay> SELECT * FROM person;
+----+--------------+-----+
| id | whole_name   | age |
+----+--------------+-----+
| 1  | John Smith   | 31  |
| 2  | Jane Cooper  | 42  |
| 3  | Kate Lee     | 25  |
| 4  | Andrew Black | 37  |
| 5  | tutu         | 45  |
+----+--------------+-----+
doltplay> INSERT INTO person(id, whole_name, age) VALUES (6, 'somebody else', 67);
Query OK, 1 row affected
failed to update indexes
doltplay> SELECT * FROM person;
+----+--------------+-----+
| id | whole_name   | age |
+----+--------------+-----+
| 1  | John Smith   | 31  |
| 2  | Jane Cooper  | 42  |
| 3  | Kate Lee     | 25  |
| 4  | Andrew Black | 37  |
| 5  | tutu         | 45  |
+----+--------------+-----+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant