forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit68dfecb
committed
Use generateClonedIndexStmt to propagate CREATE INDEX to partitions.
When instantiating an existing partitioned index for a new childpartition, we use generateClonedIndexStmt to build a suitableIndexStmt to pass to DefineIndex. However, when DefineIndex needsto recurse to instantiate a newly created partitioned index on anexisting child partition, it was doing copyObject on the givenIndexStmt and then applying a bunch of ad-hoc fixups. This hasa number of problems, primarily that it implies fresh lookups ofreferenced objects such as opclasses and collations. Since commit2af07e2 caused DefineIndex to restrict search_path internally, thoselookups could fail or deliver different results than the original one.We can avoid those problems and save a few dozen lines of code byusing generateClonedIndexStmt in this code path too.Another thing this fixes is incorrect propagation of parent-indexcomments to child indexes (because the copyObject approach copiesthe idxcomment field while generateClonedIndexStmt doesn't). I hadnoticed this in connection with commitc01eb61, but not run theproblem to ground.I'm tempted to back-patch this further than v17, but the only thingit's known to fix in older branches is the comment issue, which ispretty minor and doesn't seem worth the risk of introducing newissues in stable branches. (If anyone does care about that,clearing idxcomment in the copied IndexStmt would be a safer fix.)Per bug #18637 from usamoi. Back-patch to v17 where the search_pathchange came in.Discussion:https://postgr.es/m/18637-f51e314546e3ba2a@postgresql.org1 parentf9ecb57 commit68dfecb
File tree
7 files changed
+105
-51
lines changed- contrib/seg
- expected
- sql
- src
- backend/commands
- test/regress
- expected
- sql
7 files changed
+105
-51
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 |
| - | |
| 17 | + | |
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
|
Lines changed: 54 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
| 58 | + | |
58 | 59 |
| |
59 | 60 |
| |
60 | 61 |
|
Lines changed: 36 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + |
Lines changed: 11 additions & 45 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
| 54 | + | |
54 | 55 |
| |
55 | 56 |
| |
56 | 57 |
| |
| |||
1465 | 1466 |
| |
1466 | 1467 |
| |
1467 | 1468 |
| |
1468 |
| - | |
1469 |
| - | |
1470 |
| - | |
| 1469 | + | |
1471 | 1470 |
| |
1472 | 1471 |
| |
1473 | 1472 |
| |
1474 |
| - | |
1475 |
| - | |
1476 |
| - | |
1477 |
| - | |
1478 |
| - | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
1479 | 1478 |
| |
1480 |
| - | |
1481 |
| - | |
1482 |
| - | |
1483 |
| - | |
1484 |
| - | |
1485 |
| - | |
1486 |
| - | |
1487 |
| - | |
1488 |
| - | |
1489 |
| - | |
1490 |
| - | |
1491 |
| - | |
1492 |
| - | |
1493 |
| - | |
1494 |
| - | |
1495 |
| - | |
1496 |
| - | |
1497 |
| - | |
1498 |
| - | |
1499 |
| - | |
1500 |
| - | |
1501 |
| - | |
1502 |
| - | |
1503 |
| - | |
1504 |
| - | |
1505 |
| - | |
1506 |
| - | |
1507 |
| - | |
1508 |
| - | |
1509 |
| - | |
1510 |
| - | |
1511 |
| - | |
1512 |
| - | |
1513 |
| - | |
1514 |
| - | |
1515 |
| - | |
1516 |
| - | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
1517 | 1483 |
| |
1518 | 1484 |
| |
1519 | 1485 |
| |
|
Lines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2215 | 2215 |
| |
2216 | 2216 |
| |
2217 | 2217 |
| |
2218 |
| - | |
2219 | 2218 |
| |
2220 | 2219 |
| |
2221 | 2220 |
| |
| |||
2232 | 2231 |
| |
2233 | 2232 |
| |
2234 | 2233 |
| |
2235 |
| - | |
| 2234 | + | |
2236 | 2235 |
| |
2237 |
| - | |
| 2236 | + | |
2238 | 2237 |
| |
2239 | 2238 |
| |
2240 | 2239 |
| |
|
Lines changed: 0 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1496 | 1496 |
| |
1497 | 1497 |
| |
1498 | 1498 |
| |
1499 |
| - | |
1500 |
| - | |
1501 | 1499 |
| |
1502 | 1500 |
| |
1503 | 1501 |
| |
|
0 commit comments
Comments
(0)