forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitec62cb0
committed
Revert applying column aliases to the output of whole-row Vars.
In commitbf7ca15, I had the bright idea that we could make theresult of a whole-row Var (that is, foo.*) track any column aliasesthat had been applied to the FROM entry the Var refers to. However,that's not terribly logically consistent, because now the output ofthe Var is no longer of the named composite type that the Var claimsto emit.bf7ca15 tried to handle that by changing the outputtuple values to be labeled with a blessed RECORD type, but that'sreally pretty disastrous: we can wind up storing such tuples ontodisk, whereupon they're not readable by other sessions.The only practical fix I can see is to give up on whatbf7ca15tried to do, and say that the column names of tuples produced bya whole-row Var are always those of the underlying named compositetype, query aliases or no. While this introduces some inconsistencies,it removes others, so it's not that awful in the abstract. What *is*kind of awful is to make such a behavioral change in a back-patchedbug fix. But corrupt data is worse, so back-patched it will be.(A workaround available to anyone who's unhappy about this is tointroduce an extra level of sub-SELECT, so that the whole-row Var isreferring to the sub-SELECT's output and not to a named table type.Then the Var is of type RECORD to begin with and there's no issue.)Per report from Miles Delahunty. The faulty commit dates to 9.5,so back-patch to all supported branches.Discussion:https://postgr.es/m/2950001.1638729947@sss.pgh.pa.us1 parent39f0c4b commitec62cb0
File tree
5 files changed
+54
-92
lines changed- src
- backend/executor
- test/regress
- expected
- sql
5 files changed
+54
-92
lines changedLines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1913 | 1913 |
| |
1914 | 1914 |
| |
1915 | 1915 |
| |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
1916 | 1920 |
| |
1917 | 1921 |
| |
1918 | 1922 |
| |
1919 | 1923 |
| |
1920 | 1924 |
| |
1921 | 1925 |
| |
1922 |
| - | |
1923 |
| - | |
1924 |
| - | |
1925 |
| - | |
1926 | 1926 |
| |
1927 | 1927 |
| |
1928 | 1928 |
| |
|
Lines changed: 33 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4021 | 4021 |
| |
4022 | 4022 |
| |
4023 | 4023 |
| |
4024 |
| - | |
4025 |
| - | |
4026 |
| - | |
4027 | 4024 |
| |
4028 |
| - | |
4029 |
| - | |
| 4025 | + | |
4030 | 4026 |
| |
4031 | 4027 |
| |
4032 | 4028 |
| |
| |||
4063 | 4059 |
| |
4064 | 4060 |
| |
4065 | 4061 |
| |
4066 |
| - | |
4067 |
| - | |
4068 |
| - | |
| 4062 | + | |
| 4063 | + | |
4069 | 4064 |
| |
4070 | 4065 |
| |
4071 | 4066 |
| |
| |||
4083 | 4078 |
| |
4084 | 4079 |
| |
4085 | 4080 |
| |
4086 |
| - | |
4087 | 4081 |
| |
4088 |
| - | |
4089 |
| - | |
4090 |
| - | |
4091 |
| - | |
4092 |
| - | |
4093 |
| - | |
4094 |
| - | |
4095 |
| - | |
4096 |
| - | |
4097 |
| - | |
4098 |
| - | |
4099 |
| - | |
4100 |
| - | |
4101 |
| - | |
4102 |
| - | |
4103 |
| - | |
4104 |
| - | |
4105 |
| - | |
4106 |
| - | |
4107 |
| - | |
4108 |
| - | |
4109 |
| - | |
4110 |
| - | |
4111 |
| - | |
4112 |
| - | |
4113 |
| - | |
4114 |
| - | |
4115 |
| - | |
| 4082 | + | |
| 4083 | + | |
| 4084 | + | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
4116 | 4089 |
| |
4117 |
| - | |
4118 |
| - | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
| 4096 | + | |
| 4097 | + | |
| 4098 | + | |
| 4099 | + | |
| 4100 | + | |
| 4101 | + | |
| 4102 | + | |
| 4103 | + | |
| 4104 | + | |
| 4105 | + | |
| 4106 | + | |
| 4107 | + | |
| 4108 | + | |
| 4109 | + | |
| 4110 | + | |
| 4111 | + | |
| 4112 | + | |
4119 | 4113 |
| |
4120 | 4114 |
| |
4121 | 4115 |
| |
|
Lines changed: 13 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2022 | 2022 |
| |
2023 | 2023 |
| |
2024 | 2024 |
| |
2025 |
| - | |
| 2025 | + | |
2026 | 2026 |
| |
2027 | 2027 |
| |
2028 |
| - | |
2029 |
| - | |
2030 |
| - | |
2031 |
| - | |
2032 |
| - | |
2033 |
| - | |
2034 | 2028 |
| |
2035 | 2029 |
| |
2036 | 2030 |
| |
2037 | 2031 |
| |
2038 |
| - | |
2039 | 2032 |
| |
2040 | 2033 |
| |
2041 | 2034 |
| |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
2042 | 2039 |
| |
2043 | 2040 |
| |
2044 | 2041 |
| |
2045 | 2042 |
| |
2046 | 2043 |
| |
2047 |
| - | |
| 2044 | + | |
2048 | 2045 |
| |
2049 | 2046 |
| |
2050 | 2047 |
| |
2051 | 2048 |
| |
2052 | 2049 |
| |
2053 |
| - | |
2054 |
| - | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
2055 | 2055 |
| |
2056 | 2056 |
| |
2057 |
| - | |
2058 |
| - | |
2059 |
| - | |
2060 |
| - | |
2061 |
| - | |
2062 |
| - | |
2063 |
| - | |
2064 |
| - | |
2065 |
| - | |
2066 |
| - | |
2067 |
| - | |
2068 |
| - | |
2069 |
| - | |
| 2057 | + | |
| 2058 | + | |
2070 | 2059 |
| |
2071 | 2060 |
| |
2072 | 2061 |
| |
|
Lines changed: 2 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1010 | 1010 |
| |
1011 | 1011 |
| |
1012 | 1012 |
| |
| 1013 | + | |
1013 | 1014 |
| |
1014 |
| - | |
1015 |
| - | |
1016 |
| - | |
1017 |
| - | |
1018 |
| - | |
1019 |
| - | |
1020 |
| - | |
1021 |
| - | |
1022 |
| - | |
1023 |
| - | |
1024 |
| - | |
1025 | 1015 |
| |
1026 | 1016 |
| |
1027 | 1017 |
| |
| |||
1031 | 1021 |
| |
1032 | 1022 |
| |
1033 | 1023 |
| |
1034 |
| - | |
1035 |
| - | |
1036 |
| - | |
1037 |
| - | |
1038 |
| - | |
1039 |
| - | |
1040 |
| - | |
1041 |
| - | |
1042 |
| - | |
1043 |
| - | |
| 1024 | + | |
1044 | 1025 |
| |
1045 | 1026 |
| |
1046 | 1027 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
417 | 417 |
| |
418 | 418 |
| |
419 | 419 |
| |
| 420 | + | |
420 | 421 |
| |
421 | 422 |
| |
422 |
| - | |
423 |
| - | |
424 |
| - | |
425 |
| - | |
| 423 | + | |
426 | 424 |
| |
427 | 425 |
| |
428 | 426 |
| |
|
0 commit comments
Comments
(0)