Commit 11e8548
authored
Support INSERT without INTO keyword (#354)
## Summary
MySQL supports omitting the `INTO` keyword in `INSERT` statements (e.g.,
`INSERT t (id) VALUES (1)`), but SQLite requires it. This adds the
missing `INTO` keyword during query translation.
This is a simpler alternative to #343, focusing only on the `INTO`
keyword injection. It also adds tests covering `INSERT` without `INTO`
across multiple syntaxes: `VALUES`, `SET`, `SELECT`, and their `IGNORE`
variants.
Closes #343. Thanks @wp-fuse for reporting this!
## Test plan
- [x] `INSERT t (id, name) VALUES (1, 'a')` — VALUES syntax without
INTO.
- [x] `INSERT IGNORE t (id, name) VALUES (1, 'a')` — IGNORE without
INTO.
- [x] `INSERT t SET id = 2, name = 'b'` — SET syntax without INTO.
- [x] `INSERT IGNORE t SET id = 2, name = 'b'` — IGNORE + SET without
INTO.
- [x] `INSERT t (id, name) SELECT 3, 'c'` — SELECT syntax without INTO.
- [x] `INSERT IGNORE t (id, name) SELECT 3, 'c'` — IGNORE + SELECT
without INTO.1 parent e88f9e7 commit 11e8548
2 files changed
Lines changed: 33 additions & 0 deletions
File tree
- packages/mysql-on-sqlite
- src/sqlite
- tests
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1835 | 1835 | | |
1836 | 1836 | | |
1837 | 1837 | | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
1838 | 1843 | | |
1839 | 1844 | | |
1840 | 1845 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9986 | 9986 | | |
9987 | 9987 | | |
9988 | 9988 | | |
| 9989 | + | |
| 9990 | + | |
| 9991 | + | |
| 9992 | + | |
| 9993 | + | |
| 9994 | + | |
| 9995 | + | |
| 9996 | + | |
| 9997 | + | |
| 9998 | + | |
| 9999 | + | |
| 10000 | + | |
| 10001 | + | |
| 10002 | + | |
| 10003 | + | |
| 10004 | + | |
| 10005 | + | |
| 10006 | + | |
| 10007 | + | |
| 10008 | + | |
| 10009 | + | |
| 10010 | + | |
| 10011 | + | |
| 10012 | + | |
| 10013 | + | |
| 10014 | + | |
| 10015 | + | |
| 10016 | + | |
9989 | 10017 | | |
9990 | 10018 | | |
9991 | 10019 | | |
| |||
0 commit comments