- Notifications
You must be signed in to change notification settings - Fork5k
Commit26ae660
committed
Improve error messages about misuse of SELECT INTO.
Improve two places in plpgsql, and one in spi.c, where an errormessage would confusingly tell you that you couldn't use a SELECTquery, when what you had written *was* a SELECT query. The actualproblem is that you can't use SELECT ... INTO in these contexts,but the messages failed to make that apparent. Special-caseSELECT INTO to make these errors more helpful.Also, fix the same spots in plpgsql, as well as several messagesin exec_eval_expr(), to not quote the entire complained-of query orexpression in the primary error message. That behavior very easilyled to violating our message style guideline about keeping the primaryerror message short and single-line. Also, since the important partof the message was after the inserted text, it could make the realproblem very hard to see. We can report the query or expression asthe first line of errcontext instead.Per complaint from Roger Mason. Back-patch to v14, since (a) someof these messages are new in v14 and (b) v14's translatable stringsare still somewhat in flux. The problem's older than that ofcourse, but I'm hesitant to change the behavior further back.Discussion:https://postgr.es/m/1914708.1629474624@sss.pgh.pa.us1 parentfacce1d commit26ae660
File tree
3 files changed
+51
-17
lines changed- src
- backend/executor
- pl/plpgsql/src
- expected
3 files changed
+51
-17
lines changedLines changed: 8 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1489 | 1489 |
| |
1490 | 1490 |
| |
1491 | 1491 |
| |
| 1492 | + | |
| 1493 | + | |
1492 | 1494 |
| |
1493 | 1495 |
| |
1494 | 1496 |
| |
1495 | 1497 |
| |
1496 | 1498 |
| |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
1497 | 1504 |
| |
1498 | 1505 |
| |
1499 | 1506 |
| |
1500 |
| - | |
1501 |
| - | |
| 1507 | + | |
1502 | 1508 |
| |
1503 | 1509 |
| |
1504 | 1510 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
73 | 73 |
| |
74 | 74 |
| |
75 | 75 |
| |
76 |
| - | |
77 |
| - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
78 | 79 |
| |
79 | 80 |
| |
80 | 81 |
| |
|
Lines changed: 40 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3557 | 3557 |
| |
3558 | 3558 |
| |
3559 | 3559 |
| |
3560 |
| - | |
3561 |
| - | |
3562 |
| - | |
| 3560 | + | |
| 3561 | + | |
| 3562 | + | |
| 3563 | + | |
| 3564 | + | |
| 3565 | + | |
| 3566 | + | |
| 3567 | + | |
| 3568 | + | |
| 3569 | + | |
| 3570 | + | |
| 3571 | + | |
| 3572 | + | |
| 3573 | + | |
| 3574 | + | |
| 3575 | + | |
3563 | 3576 |
| |
3564 | 3577 |
| |
3565 | 3578 |
| |
| |||
5644 | 5657 |
| |
5645 | 5658 |
| |
5646 | 5659 |
| |
5647 |
| - | |
| 5660 | + | |
| 5661 | + | |
5648 | 5662 |
| |
5649 | 5663 |
| |
5650 | 5664 |
| |
5651 | 5665 |
| |
5652 | 5666 |
| |
5653 | 5667 |
| |
5654 | 5668 |
| |
5655 |
| - | |
5656 |
| - | |
| 5669 | + | |
| 5670 | + | |
5657 | 5671 |
| |
5658 |
| - | |
5659 |
| - | |
| 5672 | + | |
| 5673 | + | |
5660 | 5674 |
| |
5661 | 5675 |
| |
5662 | 5676 |
| |
| |||
5680 | 5694 |
| |
5681 | 5695 |
| |
5682 | 5696 |
| |
5683 |
| - | |
5684 |
| - | |
| 5697 | + | |
| 5698 | + | |
5685 | 5699 |
| |
5686 | 5700 |
| |
5687 | 5701 |
| |
| |||
5748 | 5762 |
| |
5749 | 5763 |
| |
5750 | 5764 |
| |
5751 |
| - | |
5752 |
| - | |
5753 |
| - | |
| 5765 | + | |
| 5766 | + | |
| 5767 | + | |
| 5768 | + | |
| 5769 | + | |
| 5770 | + | |
| 5771 | + | |
| 5772 | + | |
| 5773 | + | |
| 5774 | + | |
| 5775 | + | |
| 5776 | + | |
| 5777 | + | |
| 5778 | + | |
| 5779 | + | |
| 5780 | + | |
5754 | 5781 |
| |
5755 | 5782 |
| |
5756 | 5783 |
| |
|
0 commit comments
Comments
(0)