forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit761a568
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 parent2ed19a4 commit761a568
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 | |
---|---|---|---|
| |||
2418 | 2418 |
| |
2419 | 2419 |
| |
2420 | 2420 |
| |
| 2421 | + | |
2421 | 2422 |
| |
2422 | 2423 |
| |
2423 |
| - | |
2424 |
| - | |
2425 |
| - | |
2426 |
| - | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
2427 | 2434 |
| |
2428 | 2435 |
| |
2429 | 2436 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
939 | 939 |
| |
940 | 940 |
| |
941 | 941 |
| |
942 |
| - | |
| 942 | + | |
| 943 | + | |
943 | 944 |
| |
944 | 945 |
| |
945 | 946 |
| |
946 | 947 |
| |
947 | 948 |
| |
948 | 949 |
| |
949 | 950 |
| |
950 |
| - | |
| 951 | + | |
951 | 952 |
| |
952 | 953 |
| |
953 | 954 |
| |
|
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)