forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit55a1954
committed
Fix EXPLAIN's column alias output for mismatched child tables.
If an inheritance/partitioning parent table is assigned some columnalias names in the query, EXPLAIN mapped those aliases onto thechild tables' columns by physical position, resulting in bogus outputif a child table's columns aren't one-for-one with the parent's.To fix, make expand_single_inheritance_child() generate a correctlyre-mapped column alias list, rather than just copying the parentRTE's alias node. (We have to fill the alias field, not justadjust the eref field, because ruleutils.c will ignore eref infavor of looking at the real column names.)This means that child tables will now always have alias fields inplan rtables, where before they might not have. That results ina rather substantial set of regression test output changes:EXPLAIN will now always show child tables with aliases that matchthe parent table (usually with "_N" appended for uniqueness).But that seems like a net positive for understandability, sincethe parent alias corresponds to something that actually appearedin the original query, while the child table names didn't.(Note that this does not change anything for cases where an explicittable alias was written in the query for the parent table; itjust makes cases without such aliases behave similarly to that.)Hence, while we could avoid these subsidiary changes if we madeinherit.c more complicated, we choose not to.Discussion:https://postgr.es/m/12424.1575168015@sss.pgh.pa.us1 parentce76c0b commit55a1954
File tree
16 files changed
+2072
-1982
lines changed- contrib/postgres_fdw/expected
- src
- backend/optimizer/util
- test/regress
- expected
- sql
16 files changed
+2072
-1982
lines changedLines changed: 148 additions & 148 deletions
Large diffs are not rendered by default.
Lines changed: 69 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
421 | 421 |
| |
422 | 422 |
| |
423 | 423 |
| |
| 424 | + | |
| 425 | + | |
| 426 | + | |
424 | 427 |
| |
425 | 428 |
| |
426 | 429 |
| |
427 |
| - | |
| 430 | + | |
428 | 431 |
| |
429 | 432 |
| |
430 | 433 |
| |
431 | 434 |
| |
432 | 435 |
| |
433 | 436 |
| |
434 | 437 |
| |
435 |
| - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
436 | 442 |
| |
437 |
| - | |
438 |
| - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
439 | 446 |
| |
440 | 447 |
| |
441 | 448 |
| |
| |||
448 | 455 |
| |
449 | 456 |
| |
450 | 457 |
| |
| 458 | + | |
| 459 | + | |
451 | 460 |
| |
452 | 461 |
| |
| 462 | + | |
453 | 463 |
| |
454 | 464 |
| |
455 | 465 |
| |
| |||
459 | 469 |
| |
460 | 470 |
| |
461 | 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 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
462 | 519 |
| |
463 | 520 |
| |
464 | 521 |
| |
465 |
| - | |
| 522 | + | |
466 | 523 |
| |
467 | 524 |
| |
468 | 525 |
| |
| |||
479 | 536 |
| |
480 | 537 |
| |
481 | 538 |
| |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
482 | 546 |
| |
483 | 547 |
| |
484 | 548 |
| |
|
Lines changed: 26 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
998 | 998 |
| |
999 | 999 |
| |
1000 | 1000 |
| |
1001 |
| - | |
1002 |
| - | |
| 1001 | + | |
| 1002 | + | |
1003 | 1003 |
| |
1004 | 1004 |
| |
1005 | 1005 |
| |
1006 | 1006 |
| |
1007 | 1007 |
| |
1008 | 1008 |
| |
1009 | 1009 |
| |
1010 |
| - | |
| 1010 | + | |
1011 | 1011 |
| |
1012 |
| - | |
| 1012 | + | |
1013 | 1013 |
| |
1014 |
| - | |
| 1014 | + | |
1015 | 1015 |
| |
1016 | 1016 |
| |
1017 | 1017 |
| |
1018 |
| - | |
1019 |
| - | |
| 1018 | + | |
| 1019 | + | |
1020 | 1020 |
| |
1021 |
| - | |
| 1021 | + | |
1022 | 1022 |
| |
1023 |
| - | |
| 1023 | + | |
1024 | 1024 |
| |
1025 |
| - | |
| 1025 | + | |
1026 | 1026 |
| |
1027 | 1027 |
| |
1028 | 1028 |
| |
| |||
1034 | 1034 |
| |
1035 | 1035 |
| |
1036 | 1036 |
| |
1037 |
| - | |
1038 |
| - | |
| 1037 | + | |
| 1038 | + | |
1039 | 1039 |
| |
1040 | 1040 |
| |
1041 | 1041 |
| |
1042 | 1042 |
| |
1043 | 1043 |
| |
1044 | 1044 |
| |
1045 | 1045 |
| |
1046 |
| - | |
| 1046 | + | |
1047 | 1047 |
| |
1048 |
| - | |
| 1048 | + | |
1049 | 1049 |
| |
1050 |
| - | |
| 1050 | + | |
1051 | 1051 |
| |
1052 | 1052 |
| |
1053 | 1053 |
| |
1054 |
| - | |
1055 |
| - | |
| 1054 | + | |
| 1055 | + | |
1056 | 1056 |
| |
1057 |
| - | |
| 1057 | + | |
1058 | 1058 |
| |
1059 |
| - | |
| 1059 | + | |
1060 | 1060 |
| |
1061 |
| - | |
| 1061 | + | |
1062 | 1062 |
| |
1063 | 1063 |
| |
1064 | 1064 |
| |
| |||
1156 | 1156 |
| |
1157 | 1157 |
| |
1158 | 1158 |
| |
1159 |
| - | |
| 1159 | + | |
1160 | 1160 |
| |
1161 | 1161 |
| |
1162 | 1162 |
| |
| |||
1179 | 1179 |
| |
1180 | 1180 |
| |
1181 | 1181 |
| |
1182 |
| - | |
1183 |
| - | |
| 1182 | + | |
| 1183 | + | |
1184 | 1184 |
| |
1185 |
| - | |
| 1185 | + | |
1186 | 1186 |
| |
1187 |
| - | |
1188 |
| - | |
| 1187 | + | |
| 1188 | + | |
1189 | 1189 |
| |
1190 | 1190 |
| |
1191 | 1191 |
| |
|
Lines changed: 9 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
542 | 542 |
| |
543 | 543 |
| |
544 | 544 |
| |
545 |
| - | |
| 545 | + | |
546 | 546 |
| |
547 |
| - | |
| 547 | + | |
548 | 548 |
| |
549 | 549 |
| |
550 | 550 |
| |
| |||
555 | 555 |
| |
556 | 556 |
| |
557 | 557 |
| |
558 |
| - | |
| 558 | + | |
559 | 559 |
| |
560 |
| - | |
| 560 | + | |
561 | 561 |
| |
562 | 562 |
| |
563 | 563 |
| |
| |||
567 | 567 |
| |
568 | 568 |
| |
569 | 569 |
| |
570 |
| - | |
| 570 | + | |
571 | 571 |
| |
572 |
| - | |
| 572 | + | |
573 | 573 |
| |
574 |
| - | |
| 574 | + | |
575 | 575 |
| |
576 | 576 |
| |
577 | 577 |
| |
| |||
583 | 583 |
| |
584 | 584 |
| |
585 | 585 |
| |
586 |
| - | |
| 586 | + | |
587 | 587 |
| |
588 |
| - | |
| 588 | + | |
589 | 589 |
| |
590 | 590 |
| |
591 | 591 |
| |
|
0 commit comments
Comments
(0)