forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitecfed4a
committed
Improve error handling of column references in expression transformation
Column references are not allowed in default expressions and partitionbound expressions, and are restricted as such once the transformation oftheir expressions is done. However, trying to use more complex columnreferences can lead to confusing error messages. For example, trying touse a two-field column reference name for default expressions andpartition bounds leads to "missing FROM-clause entry for table", whichmakes no sense in their respective context.In order to make the errors generated more useful, this commit adds moreverbose messages when transforming column references depending on thecontext. This has a little consequence though: for example anexpression using an aggregate with a column reference as argument wouldcause an error to be generated for the column reference, while theaggregate was the problem reported before this commit because columnreferences get transformed first.The confusion exists for default expressions for a long time, and theproblem is new as of v12 for partition bounds. Still per the lack ofcomplaints on the matter no backpatch is done.The patch has been written by Amit Langote and me, and Tom Lane hasprovided the improvement of the documentation for default expressions onthe CREATE TABLE page.Author: Amit Langote, Michael PaquierReviewed-by: Tom LaneDiscussion:https://postgr.es/m/20190326020853.GM2558@paquier.xyz1 parentd2fd7f7 commitecfed4a
File tree
6 files changed
+147
-34
lines changed- doc/src/sgml/ref
- src
- backend
- catalog
- parser
- test/regress
- expected
- sql
6 files changed
+147
-34
lines changedLines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
783 | 783 |
| |
784 | 784 |
| |
785 | 785 |
| |
786 |
| - | |
787 |
| - | |
788 |
| - | |
789 |
| - | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
790 | 790 |
| |
791 | 791 |
| |
792 | 792 |
| |
|
Lines changed: 4 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2939 | 2939 |
| |
2940 | 2940 |
| |
2941 | 2941 |
| |
2942 |
| - | |
2943 |
| - | |
2944 |
| - | |
2945 |
| - | |
2946 |
| - | |
2947 |
| - | |
2948 |
| - | |
2949 |
| - | |
2950 |
| - | |
2951 |
| - | |
2952 |
| - | |
2953 |
| - | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
2954 | 2945 |
| |
| 2946 | + | |
2955 | 2947 |
| |
2956 | 2948 |
| |
2957 | 2949 |
| |
|
Lines changed: 73 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
520 | 520 |
| |
521 | 521 |
| |
522 | 522 |
| |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
523 | 596 |
| |
524 | 597 |
| |
525 | 598 |
| |
|
Lines changed: 6 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3926 | 3926 |
| |
3927 | 3927 |
| |
3928 | 3928 |
| |
3929 |
| - | |
3930 |
| - | |
3931 |
| - | |
3932 |
| - | |
3933 |
| - | |
3934 |
| - | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
| 3932 | + | |
| 3933 | + | |
| 3934 | + | |
3935 | 3935 |
| |
3936 | 3936 |
| |
3937 | 3937 |
| |
|
Lines changed: 46 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
297 | 297 |
| |
298 | 298 |
| |
299 | 299 |
| |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
300 | 334 |
| |
301 | 335 |
| |
302 | 336 |
| |
| |||
491 | 525 |
| |
492 | 526 |
| |
493 | 527 |
| |
494 |
| - | |
| 528 | + | |
495 | 529 |
| |
496 | 530 |
| |
497 | 531 |
| |
498 |
| - | |
| 532 | + | |
499 | 533 |
| |
500 | 534 |
| |
501 | 535 |
| |
502 |
| - | |
| 536 | + | |
503 | 537 |
| |
504 | 538 |
| |
505 | 539 |
| |
506 |
| - | |
| 540 | + | |
507 | 541 |
| |
508 |
| - | |
| 542 | + | |
509 | 543 |
| |
510 |
| - | |
| 544 | + | |
511 | 545 |
| |
512 | 546 |
| |
513 | 547 |
| |
| |||
573 | 607 |
| |
574 | 608 |
| |
575 | 609 |
| |
576 |
| - | |
| 610 | + | |
577 | 611 |
| |
578 | 612 |
| |
579 | 613 |
| |
580 | 614 |
| |
581 |
| - | |
| 615 | + | |
582 | 616 |
| |
583 | 617 |
| |
584 | 618 |
| |
585 | 619 |
| |
586 |
| - | |
| 620 | + | |
587 | 621 |
| |
588 | 622 |
| |
589 | 623 |
| |
590 | 624 |
| |
591 |
| - | |
| 625 | + | |
592 | 626 |
| |
593 |
| - | |
| 627 | + | |
594 | 628 |
| |
595 | 629 |
| |
596 |
| - | |
| 630 | + | |
597 | 631 |
| |
598 | 632 |
| |
599 | 633 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
304 | 304 |
| |
305 | 305 |
| |
306 | 306 |
| |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
307 | 321 |
| |
308 | 322 |
| |
309 | 323 |
| |
|
0 commit comments
Comments
(0)