forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit662d12a
committed
Avoid crash in eval_const_expressions if a Param's type changes.
Since commit6719b23 it's been possible for the values of plpgsqlrecord field variables to be exposed to the planner as Params.(Before that, plpgsql never supplied values for such variables duringplanning, so that the problematic code wasn't reached.) Other placesthat touch potentially-type-mutable Params either cope gracefully ordo runtime-test-and-ereport checks that the type is what they expect.But eval_const_expressions() just had an Assert, meaning that it eitherfailed the assertion or risked crashes due to using an incompatiblevalue.In this case, rather than throwing an ereport immediately, we can justnot perform a const-substitution in case of a mismatch. This seemsimportant for the same reason that the Param fetch was speculative:we might not actually reach this part of the expression at runtime.Test case will follow in a separate commit.Patch by me, pursuant to bug report from Andrew Gierth.Back-patch to v11 where the previous commit appeared.Discussion:https://postgr.es/m/87wotkfju1.fsf@news-spur.riddles.org.uk1 parent3acc4ac commit662d12a
1 file changed
+8
-2
lines changedLines changed: 8 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2567 | 2567 |
| |
2568 | 2568 |
| |
2569 | 2569 |
| |
2570 |
| - | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
2571 | 2578 |
| |
2572 | 2579 |
| |
2573 | 2580 |
| |
| |||
2583 | 2590 |
| |
2584 | 2591 |
| |
2585 | 2592 |
| |
2586 |
| - | |
2587 | 2593 |
| |
2588 | 2594 |
| |
2589 | 2595 |
| |
|
0 commit comments
Comments
(0)