forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite6dbb48
committed
Fix subtly-incorrect matching of parent and child partitioned indexes.
When creating a partitioned index, DefineIndex tries to identifyany existing indexes on the partitions that match the partitionedindex, so that it can absorb those as child indexes instead ofbuilding new ones. Part of the matching is to compare IndexInfostructs --- but that wasn't done quite right. We're comparingthe IndexInfo built within DefineIndex itself to one made fromexisting catalog contents by BuildIndexInfo. Notably, whileBuildIndexInfo will run index expressions and predicates throughexpression preprocessing, that has not happened to DefineIndex'sstruct. The result is failure to match and subsequent creationof duplicate indexes.The easiest and most bulletproof fix is to build a new IndexInfousing BuildIndexInfo, thereby guaranteeing that the processing doneis identical.While here, let's also extract the opfamily and collation datafrom the new partitioned index, removing ad-hoc logic thatduplicated knowledge about how those are constructed.Per report from Christophe Pettus. Back-patch to v11 wherewe invented partitioned indexes.Richard Guo and Tom LaneDiscussion:https://postgr.es/m/8864BFAA-81FD-4BF9-8E06-7DEB8D4164ED@thebuild.com1 parent3e63e84 commite6dbb48
File tree
3 files changed
+96
-8
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+96
-8
lines changedLines changed: 17 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1213 | 1213 |
| |
1214 | 1214 |
| |
1215 | 1215 |
| |
| 1216 | + | |
1216 | 1217 |
| |
1217 |
| - | |
1218 | 1218 |
| |
1219 | 1219 |
| |
1220 | 1220 |
| |
1221 | 1221 |
| |
| 1222 | + | |
1222 | 1223 |
| |
1223 | 1224 |
| |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
1224 | 1236 |
| |
1225 |
| - | |
1226 |
| - | |
1227 |
| - | |
1228 | 1237 |
| |
1229 | 1238 |
| |
1230 | 1239 |
| |
| |||
1295 | 1304 |
| |
1296 | 1305 |
| |
1297 | 1306 |
| |
1298 |
| - | |
| 1307 | + | |
1299 | 1308 |
| |
1300 |
| - | |
| 1309 | + | |
1301 | 1310 |
| |
1302 | 1311 |
| |
1303 | 1312 |
| |
| |||
1424 | 1433 |
| |
1425 | 1434 |
| |
1426 | 1435 |
| |
| 1436 | + | |
| 1437 | + | |
1427 | 1438 |
| |
1428 | 1439 |
| |
1429 | 1440 |
| |
|
Lines changed: 65 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
378 | 378 |
| |
379 | 379 |
| |
380 | 380 |
| |
381 |
| - | |
| 381 | + | |
382 | 382 |
| |
383 | 383 |
| |
384 | 384 |
| |
| |||
389 | 389 |
| |
390 | 390 |
| |
391 | 391 |
| |
| 392 | + | |
392 | 393 |
| |
393 | 394 |
| |
394 | 395 |
| |
| |||
415 | 416 |
| |
416 | 417 |
| |
417 | 418 |
| |
| 419 | + | |
418 | 420 |
| |
419 | 421 |
| |
420 | 422 |
| |
| |||
434 | 436 |
| |
435 | 437 |
| |
436 | 438 |
| |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 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 | + | |
437 | 501 |
| |
438 | 502 |
| |
439 | 503 |
| |
|
Lines changed: 14 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
192 | 192 |
| |
193 | 193 |
| |
194 | 194 |
| |
195 |
| - | |
| 195 | + | |
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
| |||
203 | 203 |
| |
204 | 204 |
| |
205 | 205 |
| |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
206 | 219 |
| |
207 | 220 |
| |
208 | 221 |
| |
|
0 commit comments
Comments
(0)