Commit a5e9fbe
committed
sql: avoid unnecessary column dependencies in routines
Previously, there were several cases where routines would add unnecessary
column dependencies:
* Columns referenced by a computed column expression would be added to
the list of columns referenced by the routine.
* BEFORE triggers would confuse the logic used to distinguish explicit
from implicit INSERT columns, because triggers change the column IDs
to be inserted. This could cause the routine to add implicitly referenced
columns to its dependencies.
* Dependencies from statements within a trigger would transitively apply
to a routine that invoked trigger on a mutation.
This commit prevents newly-created routines from adding unnecessary
column dependencies in those cases, gated behind the session setting
`use_improved_routine_deps_triggers_and_computed_cols`.
Fixes #158154
Release note (bug fix): Fixed a bug that caused routines to prevent
dropping more columns than necessary, most notably columns referenced
by computed column expressions. The fix is gated behind the session
setting `use_improved_routine_deps_triggers_and_computed_cols`, which
is off by default prior to v26.1.1 parent 9c106f8 commit a5e9fbe
File tree
17 files changed
+215
-32
lines changed- pkg
- ccl/logictestccl/testdata/logic_test
- sql
- logictest/testdata/logic_test
- opt
- memo
- optbuilder
- sessiondatapb
- sessionmutator
17 files changed
+215
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5121 | 5121 | | |
5122 | 5122 | | |
5123 | 5123 | | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
| 5128 | + | |
| 5129 | + | |
| 5130 | + | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
| 5156 | + | |
| 5157 | + | |
| 5158 | + | |
| 5159 | + | |
| 5160 | + | |
| 5161 | + | |
| 5162 | + | |
| 5163 | + | |
| 5164 | + | |
| 5165 | + | |
| 5166 | + | |
| 5167 | + | |
| 5168 | + | |
| 5169 | + | |
| 5170 | + | |
| 5171 | + | |
| 5172 | + | |
| 5173 | + | |
| 5174 | + | |
| 5175 | + | |
| 5176 | + | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
5124 | 5185 | | |
5125 | 5186 | | |
5126 | 5187 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4285 | 4285 | | |
4286 | 4286 | | |
4287 | 4287 | | |
| 4288 | + | |
4288 | 4289 | | |
4289 | 4290 | | |
4290 | 4291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3241 | 3241 | | |
3242 | 3242 | | |
3243 | 3243 | | |
| 3244 | + | |
3244 | 3245 | | |
3245 | 3246 | | |
3246 | 3247 | | |
| |||
3492 | 3493 | | |
3493 | 3494 | | |
3494 | 3495 | | |
| 3496 | + | |
3495 | 3497 | | |
3496 | 3498 | | |
3497 | 3499 | | |
| |||
3735 | 3737 | | |
3736 | 3738 | | |
3737 | 3739 | | |
| 3740 | + | |
3738 | 3741 | | |
3739 | 3742 | | |
3740 | 3743 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
241 | 252 | | |
242 | 253 | | |
243 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
| |||
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
| 340 | + | |
339 | 341 | | |
340 | 342 | | |
341 | 343 | | |
| |||
518 | 520 | | |
519 | 521 | | |
520 | 522 | | |
| 523 | + | |
521 | 524 | | |
522 | 525 | | |
523 | 526 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
617 | 617 | | |
618 | 618 | | |
619 | 619 | | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
620 | 626 | | |
621 | 627 | | |
622 | 628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
604 | 625 | | |
605 | 626 | | |
606 | 627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
402 | 405 | | |
403 | 406 | | |
404 | 407 | | |
| |||
0 commit comments