forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6af63cf
committed
Fix confusion about event trigger vs. plain function in plpgsql.
The function hash table keys made by compute_function_hashkey() failedto distinguish event-trigger call context from regular call context.This meant that once we'd successfully made a hash entry for an eventtrigger (either by validation, or by normal use as an event trigger),an attempt to call the trigger function as a plain function wouldfind this hash entry and thereby bypass the you-can't-do-that check indo_compile(). Thus we'd attempt to execute the function, leading tostrange errors or even crashes, depending on function contents andserver version.To fix, add an isEventTrigger field to PLpgSQL_func_hashkey,paralleling the longstanding infrastructure for regular triggers.This fits into what had been pad space, so there's no risk of an ABIbreak, even assuming that any third-party code is looking at thesehash keys. (I considered replacing isTrigger with a PLpgSQL_trigtypeenum field, but felt that that carried some API/ABI risk. Maybe weshould change it in HEAD though.)Per bug #16266 from Alexander Lakhin. This has been broken sinceevent triggers were invented, so back-patch to all supported branches.Discussion:https://postgr.es/m/16266-fcd7f838e97ba5d4@postgresql.org1 parent79f344d commit6af63cf
File tree
4 files changed
+21
-6
lines changed- src
- pl/plpgsql/src
- test/regress
- expected
- sql
4 files changed
+21
-6
lines changedLines changed: 11 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2453 | 2453 |
| |
2454 | 2454 |
| |
2455 | 2455 |
| |
| 2456 | + | |
2456 | 2457 |
| |
2457 | 2458 |
| |
2458 |
| - | |
2459 |
| - | |
2460 |
| - | |
2461 |
| - | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
2462 | 2469 |
| |
2463 | 2470 |
| |
2464 | 2471 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
776 | 776 |
| |
777 | 777 |
| |
778 | 778 |
| |
779 |
| - | |
| 779 | + | |
| 780 | + | |
780 | 781 |
| |
781 | 782 |
| |
782 | 783 |
| |
783 | 784 |
| |
784 | 785 |
| |
785 | 786 |
| |
786 | 787 |
| |
787 |
| - | |
| 788 | + | |
788 | 789 |
| |
789 | 790 |
| |
790 | 791 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 |
| |
13 | 17 |
| |
14 | 18 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 |
| |
14 | 17 |
| |
15 | 18 |
| |
|
0 commit comments
Comments
(0)