forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitae69c4f
committed
Fix use of incorrect TupleTableSlot in DISTINCT aggregates
1349d27 added code to allow DISTINCT and ORDER BY aggregates to workmore efficiently by using presorted input. That commit added some codethat made use of the AggState's tmpcontext and adjusted theecxt_outertuple and ecxt_innertuple slots before checking if the currentrow is distinct from the previously seen row. That code forgot to set theTupleTableSlots back to what they were originally, which could result inerrors such as:ERROR: attribute 1 of type record has wrong typeThis only affects aggregate functions which have multiple arguments whenDISTINCT is used. For example: string_agg(DISTINCT col, ', ')Thanks to Tom Lane for identifying the breaking commit.Bug: #18264Reported-by: Vojtěch BenešDiscussion:https://postgr.es/m/18264-e363593d7e9feb7d@postgresql.orgBackpatch-through: 16, where1349d27 was added1 parent007693f commitae69c4f
File tree
3 files changed
+39
-3
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+39
-3
lines changedLines changed: 17 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4579 | 4579 |
| |
4580 | 4580 |
| |
4581 | 4581 |
| |
4582 |
| - | |
| 4582 | + | |
| 4583 | + | |
4583 | 4584 |
| |
4584 | 4585 |
| |
4585 | 4586 |
| |
4586 | 4587 |
| |
4587 | 4588 |
| |
| 4589 | + | |
| 4590 | + | |
| 4591 | + | |
4588 | 4592 |
| |
4589 | 4593 |
| |
4590 | 4594 |
| |
| |||
4596 | 4600 |
| |
4597 | 4601 |
| |
4598 | 4602 |
| |
| 4603 | + | |
| 4604 | + | |
| 4605 | + | |
| 4606 | + | |
4599 | 4607 |
| |
4600 | 4608 |
| |
4601 | 4609 |
| |
| |||
4607 | 4615 |
| |
4608 | 4616 |
| |
4609 | 4617 |
| |
4610 |
| - | |
| 4618 | + | |
| 4619 | + | |
4611 | 4620 |
| |
4612 |
| - | |
| 4621 | + | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
| 4625 | + | |
| 4626 | + | |
4613 | 4627 |
| |
4614 | 4628 |
| |
4615 | 4629 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1694 | 1694 |
| |
1695 | 1695 |
| |
1696 | 1696 |
| |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
1697 | 1710 |
| |
1698 | 1711 |
| |
1699 | 1712 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
643 | 643 |
| |
644 | 644 |
| |
645 | 645 |
| |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
646 | 655 |
| |
647 | 656 |
| |
648 | 657 |
| |
|
0 commit comments
Comments
(0)