forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork0
Commit0a2381d
committed
Fix broken logic for reporting PL/Python function names in errcontext.
plpython_error_callback() reported the name of the function associatedwith the topmost PL/Python execution context. This was not merelywrong if there were nested PL/Python contexts, but it risked a coredump if the topmost one is an inline code block rather than a namedfunction. That will have proname = NULL, and so we were passing a NULLpointer to snprintf("%s"). It seems that none of the PL/Python-testingmachines in the buildfarm will dump core for that, but some platforms do,as reported by Marina Polyakova.Investigation finds that there actually is an existing regression testthat used to prove that the behavior was wrong, though apparently no onehad noticed that it was printing the wrong function name. It stoppedshowing the problem in 9.6 when we adjusted psql to not print CONTEXTby default for NOTICE messages. The problem is masked (if your platformavoids the core dump) in error cases, because PL/Python will throw awaythe originally generated error info in favor of a new traceback producedat the outer level.Repair by using ErrorContextCallback.arg to pass the correct context tothe error callback. Add a regression test illustrating correct behavior.Back-patch to all supported branches, since they're all broken this way.Discussion:https://postgr.es/m/156b989dbc6fe7c4d3223cf51da61195@postgrespro.ru1 parent4b7f418 commit0a2381d
File tree
6 files changed
+112
-29
lines changed- src/pl/plpython
- expected
- sql
6 files changed
+112
-29
lines changedLines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
422 | 422 |
| |
423 | 423 |
| |
424 | 424 |
| |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + |
Lines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
422 | 422 |
| |
423 | 423 |
| |
424 | 424 |
| |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + |
Lines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
422 | 422 |
| |
423 | 423 |
| |
424 | 424 |
| |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + |
Lines changed: 26 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
232 | 232 |
| |
233 | 233 |
| |
234 | 234 |
| |
235 |
| - | |
236 |
| - | |
| 235 | + | |
237 | 236 |
| |
238 | 237 |
| |
239 | 238 |
| |
240 |
| - | |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 |
| - | |
247 | 239 |
| |
248 | 240 |
| |
249 | 241 |
| |
250 | 242 |
| |
251 | 243 |
| |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
252 | 255 |
| |
253 | 256 |
| |
254 | 257 |
| |
| |||
274 | 277 |
| |
275 | 278 |
| |
276 | 279 |
| |
277 |
| - | |
278 |
| - | |
279 |
| - | |
| 280 | + | |
280 | 281 |
| |
281 | 282 |
| |
282 | 283 |
| |
| |||
323 | 324 |
| |
324 | 325 |
| |
325 | 326 |
| |
326 |
| - | |
327 |
| - | |
328 |
| - | |
| 327 | + | |
329 | 328 |
| |
330 | 329 |
| |
331 | 330 |
| |
332 |
| - | |
333 |
| - | |
334 |
| - | |
335 |
| - | |
336 |
| - | |
337 |
| - | |
338 |
| - | |
339 | 331 |
| |
340 | 332 |
| |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
341 | 343 |
| |
342 | 344 |
| |
343 | 345 |
| |
| |||
351 | 353 |
| |
352 | 354 |
| |
353 | 355 |
| |
354 |
| - | |
355 |
| - | |
356 |
| - | |
| 356 | + | |
357 | 357 |
| |
358 | 358 |
| |
359 | 359 |
| |
| |||
381 | 381 |
| |
382 | 382 |
| |
383 | 383 |
| |
384 |
| - | |
| 384 | + | |
385 | 385 |
| |
386 | 386 |
| |
387 | 387 |
| |
|
Lines changed: 1 addition & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
50 |
| - | |
51 |
| - | |
52 |
| - | |
| 50 | + | |
53 | 51 |
| |
54 | 52 |
| |
55 | 53 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
328 | 328 |
| |
329 | 329 |
| |
330 | 330 |
| |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + |
0 commit comments
Comments
(0)