forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2489c38
committed
Avoid crash after function syntax error in a replication worker.
If a syntax error occurred in a SQL-language or PL/pgSQL-languageCREATE FUNCTION or DO command executed in a logical replication worker,we'd suffer a null pointer dereference or assertion failure. Thatseems like a rather contrived case, but nonetheless worth fixing.The cause is that function_parse_error_transpose assumes it must beexecuting within the context of a Portal, but logical/worker.cdoesn't create a Portal since it's not running the standard executor.We can just back off the hard Assert check and make it fail gracefullyif there's not an ActivePortal. (I have a feeling that the aggressivecheck here was my fault originally, probably because I wasn't sure ifthe case would always hold and wanted to find out. Well, now we know.)The hazard seems to exist in all branches that have logical replication,so back-patch to v10.Maxim Orlov, Anton Melnikov, Masahiko Sawada, Tom LaneDiscussion:https://postgr.es/m/b570c367-ba38-95f3-f62d-5f59b9808226@inbox.ruDiscussion:https://postgr.es/m/adf0452f-8c6b-7def-d35e-ab516c80088e@inbox.ru1 parenteeb5461 commit2489c38
1 file changed
+15
-5
lines changedLines changed: 15 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1012 | 1012 |
| |
1013 | 1013 |
| |
1014 | 1014 |
| |
1015 |
| - | |
1016 | 1015 |
| |
1017 | 1016 |
| |
1018 | 1017 |
| |
| |||
1030 | 1029 |
| |
1031 | 1030 |
| |
1032 | 1031 |
| |
1033 |
| - | |
1034 |
| - | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
1035 | 1035 |
| |
1036 |
| - | |
1037 |
| - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1038 | 1048 |
| |
1039 | 1049 |
| |
1040 | 1050 |
| |
|
0 commit comments
Comments
(0)