forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbd673e8
committed
Make sure ALTER TABLE preserves index tablespaces.
When rebuilding an existing index, ALTER TABLE correctly kept thephysical file in the same tablespace, but it messed up the pg_classentry if the index had been in the database's default tablespaceand "default_tablespace" was set to some non-default tablespace.This led to an inaccessible index.Fix by fixing pg_get_indexdef_string() to always include a tablespaceclause, whether or not the index is in the default tablespace. Theprevious behavior was installed in commit537e92e, and I think it justwasn't thought through very clearly; certainly the possible effect ofdefault_tablespace wasn't considered. There's some risk in changing thebehavior of this function, but there are no other call sites in the corecode. Even if it's being used by some third party extension, it's fairlyhard to envision a usage that is okay with a tablespace clause beingappended some of the time but can't handle it being appended all the time.Back-patch to all supported versions.Code fix by me, investigation and test cases by Michael Paquier.Discussion: <1479294998857-5930602.post@n3.nabble.com>1 parente343dfa commitbd673e8
File tree
3 files changed
+149
-10
lines changed- src
- backend/utils/adt
- test/regress
- input
- output
3 files changed
+149
-10
lines changedLines changed: 13 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1061 | 1061 |
| |
1062 | 1062 |
| |
1063 | 1063 |
| |
1064 |
| - | |
| 1064 | + | |
1065 | 1065 |
| |
1066 | 1066 |
| |
1067 | 1067 |
| |
| |||
1102 | 1102 |
| |
1103 | 1103 |
| |
1104 | 1104 |
| |
1105 |
| - | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1106 | 1110 |
| |
1107 | 1111 |
| |
1108 | 1112 |
| |
| |||
1360 | 1364 |
| |
1361 | 1365 |
| |
1362 | 1366 |
| |
1363 |
| - | |
| 1367 | + | |
1364 | 1368 |
| |
1365 | 1369 |
| |
1366 | 1370 |
| |
1367 | 1371 |
| |
1368 | 1372 |
| |
1369 | 1373 |
| |
1370 |
| - | |
1371 |
| - | |
1372 |
| - | |
1373 |
| - | |
1374 |
| - | |
1375 |
| - | |
1376 |
| - | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
1377 | 1380 |
| |
1378 | 1381 |
| |
1379 | 1382 |
| |
|
Lines changed: 31 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
47 | 78 |
| |
48 | 79 |
| |
49 | 80 |
| |
|
Lines changed: 105 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 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 | + | |
64 | 169 |
| |
65 | 170 |
| |
66 | 171 |
| |
|
0 commit comments
Comments
(0)