forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7a3b7bb
committed
Fix snapshot leak warning for some procedures
The problem arises with the combination of CALL with output parametersand doing a COMMIT inside the procedure. When a CALL has outputparameters, the portal uses the strategy PORTAL_UTIL_SELECT instead ofPORTAL_MULTI_QUERY. Using PORTAL_UTIL_SELECT causes the portal'ssnapshot to be registered with the current resourceowner (portal->holdSnapshot); see9ee1cf0 for the reason.Normally, PortalDrop() unregisters the snapshot. If not, thenResourceOwnerRelease() will print a warning about a snapshot leak ontransaction commit. A transaction commit normally drops allportals (PreCommit_Portals()), except the active portal. So in case ofthe active portal, we need to manually release the snapshot to avoid thewarning.Reported-by: Prabhat Sahu <prabhat.sahu@enterprisedb.com>Reviewed-by: Jonathan S. Katz <jkatz@postgresql.org>1 parentcbdca00 commit7a3b7bb
File tree
3 files changed
+67
-2
lines changed- src
- backend/utils/mmgr
- pl/plpgsql/src
- expected
- sql
3 files changed
+67
-2
lines changedLines changed: 12 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
689 | 689 |
| |
690 | 690 |
| |
691 | 691 |
| |
692 |
| - | |
| 692 | + | |
| 693 | + | |
693 | 694 |
| |
694 | 695 |
| |
695 |
| - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
696 | 699 |
| |
697 | 700 |
| |
698 | 701 |
| |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
699 | 709 |
| |
700 | 710 |
| |
701 | 711 |
| |
|
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
463 | 463 |
| |
464 | 464 |
| |
465 | 465 |
| |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
466 | 496 |
| |
467 | 497 |
| |
468 | 498 |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
387 | 387 |
| |
388 | 388 |
| |
389 | 389 |
| |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
390 | 415 |
| |
391 | 416 |
| |
392 | 417 |
|
0 commit comments
Comments
(0)