Repository navigation
Commit 5859236
committed
fix(lint): a join inside UPDATE FROM never limits the write
SQLCLEAN049 counted a join in an UPDATE's FROM list as limiting the rows
written, so UPDATE t SET x = 1 FROM a JOIN b ON a.k = b.k was not
reported, though it changes every row of t. A join inside FROM, or
inside a DELETE's USING list, cannot read the target: PostgreSQL, DuckDB
and SQLite all refuse an ON that names it. So only WHERE, LIMIT and a
join on the target itself (UPDATE's table joins and the MySQL
multi-table DELETE's joins) limit which rows change.
PostgreSQL and DuckDB cases cover the one-item, comma and parenthesised
forms and DELETE USING, each changing every row on the engines, and the
same statements with a WHERE reading the target, which change one.1 parent 4b50102 commit 5859236
2 files changed
Lines changed: 29 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
481 | 482 | | |
482 | 483 | | |
483 | 484 | | |
484 | 485 | | |
485 | 486 | | |
486 | 487 | | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
| 488 | + | |
492 | 489 | | |
493 | 490 | | |
494 | 491 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
167 | 194 | | |
168 | 195 | | |
169 | 196 | | |
| |||
0 commit comments