dolthub / dolthub/dolt

Allow `INSERT` on `VIEW`

Open
#10,292 0 comments 0 reactions 0 assignees View on GitHub
analyzer bug correctness
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

MySQL allows `INSERT` on `VIEW`s while Dolt does not.

MySQL
```
mysql> select * from mytable;
+---+------------+
| i | s |
+---+------------+
| 1 | first row |
| 2 | second row |
| 3 | third row |
+---+------------+
3 rows in set (0.01 sec)

mysql> create view myview as select * from mytable;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from myview;
+---+------------+
| i | s |
+---+------------+
| 1 | first row |
| 2 | second row |
| 3 | third row |
| 5 | fifth row |
+---+------------+
4 rows in set (0.01 sec)

mysql> select * from mytable;
+---+------------+
| i | s |
+---+------------+
| 1 | first row |
| 2 | second row |
| 3 | third row |
| 5 | fifth row |
+---+------------+
4 rows in set (0.00 sec)
```

Dolt
```
tmp/main*> select * from mytable;
+---+------------+
| i | s |
+---+------------+
| 1 | first row |
| 2 | second row |
| 3 | third row |
+---+------------+
3 rows in set (0.00 sec)

tmp/main*> create view myview as select * from mytable;
Query OK, 0 rows affected (0.01 sec)
tmp/main*> insert into myview values (5, 'fifth row');
expected insert destination to be resolved or unresolved table
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named. Reproduce the reported CREATE VIEW followed by INSERT sequence and trace INSERT destination resolution for views; done means inserts through a view succeed and the underlying table reflects the new row, with coverage for this behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.