forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit612d207
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 parent414ed1c commit612d207
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 | |
---|---|---|---|
| |||
2411 | 2411 |
| |
2412 | 2412 |
| |
2413 | 2413 |
| |
| 2414 | + | |
2414 | 2415 |
| |
2415 | 2416 |
| |
2416 |
| - | |
2417 |
| - | |
2418 |
| - | |
2419 |
| - | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
2420 | 2427 |
| |
2421 | 2428 |
| |
2422 | 2429 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
901 | 901 |
| |
902 | 902 |
| |
903 | 903 |
| |
904 |
| - | |
| 904 | + | |
| 905 | + | |
905 | 906 |
| |
906 | 907 |
| |
907 | 908 |
| |
908 | 909 |
| |
909 | 910 |
| |
910 | 911 |
| |
911 | 912 |
| |
912 |
| - | |
| 913 | + | |
913 | 914 |
| |
914 | 915 |
| |
915 | 916 |
| |
|
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)