forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit52898c6
committed
Make INSERT-from-multiple-VALUES-rows handle domain target columns.
Commita3c7a99 fixed some cases involving target columns that arearrays or composites by applying transformAssignedExpr to the VALUESentries, and then stripping off any assignment ArrayRefs orFieldStores that the transformation added. But I forgot about domainsover arrays or composites :-(. Such cases would either fail withsurprising complaints about mismatched datatypes, or insert unexpectedcoercions that could lead to odd results. To fix, extend thestripping logic to get rid of CoerceToDomain if it's atop an ArrayRefor FieldStore.While poking at this, I realized that there's a poorly documented andnot-at-all-tested behavior nearby: we coerce each VALUES column tothe domain type separately, and rely on the rewriter to merge thoseoperations so that the domain constraints are checked only once.If that merging did not happen, it's entirely possible that we'd getunexpected domain constraint failures due to checking apartially-updated container value. There's no bug there, but whilewe're here let's improve the commentary about it and add some testcases that explicitly exercise that behavior.Per bug #18393 from Pablo Kharo. Back-patch to all supportedbranches.Discussion:https://postgr.es/m/18393-65fedb1a0de9260d@postgresql.org1 parentd4c573d commit52898c6
File tree
5 files changed
+227
-11
lines changed- src
- backend
- parser
- rewrite
- test/regress
- expected
- sql
5 files changed
+227
-11
lines changedLines changed: 15 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1072 | 1072 |
| |
1073 | 1073 |
| |
1074 | 1074 |
| |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1075 | 1080 |
| |
1076 | 1081 |
| |
1077 |
| - | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1078 | 1089 |
| |
1079 |
| - | |
| 1090 | + | |
1080 | 1091 |
| |
1081 | 1092 |
| |
1082 | 1093 |
| |
1083 |
| - | |
| 1094 | + | |
1084 | 1095 |
| |
1085 |
| - | |
| 1096 | + | |
1086 | 1097 |
| |
1087 | 1098 |
| |
1088 | 1099 |
| |
|
Lines changed: 16 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
821 | 821 |
| |
822 | 822 |
| |
823 | 823 |
| |
824 |
| - | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
825 | 834 |
| |
826 | 835 |
| |
827 | 836 |
| |
| |||
967 | 976 |
| |
968 | 977 |
| |
969 | 978 |
| |
970 |
| - | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
971 | 985 |
| |
972 | 986 |
| |
973 | 987 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1087 | 1087 |
| |
1088 | 1088 |
| |
1089 | 1089 |
| |
1090 |
| - | |
1091 |
| - | |
1092 |
| - | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1093 | 1093 |
| |
1094 | 1094 |
| |
1095 | 1095 |
| |
|
Lines changed: 115 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
180 | 180 |
| |
181 | 181 |
| |
182 | 182 |
| |
183 |
| - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
184 | 298 |
| |
185 | 299 |
| |
186 | 300 |
| |
|
Lines changed: 78 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
108 |
| - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
109 | 186 |
| |
110 | 187 |
| |
111 | 188 |
| |
|
0 commit comments
Comments
(0)