- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit92a9ba3
committed
Fix deparsing FETCH FIRST <expr> ROWS WITH TIES
In the grammar, <expr> is a c_expr, which accepts only a limited setof integer literals and simple expressions without parens. Thedeparsing logic didn't quite match the grammar rule, and failed to useparens e.g. for "5::bigint".To fix, always surround the expression with parens. Would be nice toomit the parens in simple cases, but unfortunately it's non-trivial todetect such simple cases. Even if the expression is a simple literal123 in the original query, after parse analysis it becomes a FuncExprwith COERCE_IMPLICIT_CAST rather than a simple Const.Reported-by: yonghao leeBackpatch-through: 13Discussion:https://www.postgresql.org/message-id/18929-077d6b7093b176e2@postgresql.org1 parentc0f51fd commit92a9ba3
File tree
3 files changed
+31
-4
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+31
-4
lines changedLines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5733 | 5733 |
| |
5734 | 5734 |
| |
5735 | 5735 |
| |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
| 5742 | + | |
| 5743 | + | |
5736 | 5744 |
| |
5737 | 5745 |
| |
| 5746 | + | |
5738 | 5747 |
| |
| 5748 | + | |
5739 | 5749 |
| |
5740 | 5750 |
| |
5741 | 5751 |
| |
|
Lines changed: 17 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
643 | 643 |
| |
644 | 644 |
| |
645 | 645 |
| |
646 |
| - | |
| 646 | + | |
647 | 647 |
| |
648 | 648 |
| |
649 | 649 |
| |
| |||
675 | 675 |
| |
676 | 676 |
| |
677 | 677 |
| |
678 |
| - | |
| 678 | + | |
679 | 679 |
| |
680 | 680 |
| |
681 |
| - | |
| 681 | + | |
682 | 682 |
| |
683 | 683 |
| |
684 | 684 |
| |
685 | 685 |
| |
686 | 686 |
| |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
687 | 701 |
| |
688 | 702 |
| |
689 | 703 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
199 |
| - | |
| 199 | + | |
200 | 200 |
| |
| 201 | + | |
| 202 | + | |
| 203 | + | |
201 | 204 |
|
0 commit comments
Comments
(0)