forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitaa01051
committed
pg_upgrade: Preserve database OIDs.
Commit9a974cb arranged to preserverelfilenodes and tablespace OIDs. For similar reasons, also arrangeto preserve database OIDs.One problem is that, up until now, the OIDs assigned to the template0and postgres databases have not been fixed. This could be a problemwhen upgrading, because pg_upgrade might try to migrate a databasefrom the old cluster to the new cluster while keeping the OID and finda different database with that OID, resulting in a failure. If it findsa database with the same name and the same OID that's OK: it will bedropped and recreated. But the same OID and a different name is aproblem.To prevent that, fix the OIDs for postgres and template0 to specificvalues less than 16384. To avoid running afoul of this rule, thesevalues should not be changed in future releases. It's not a problemthat these OIDs aren't fixed in existing releases, because the OIDsthat we're assigning here weren't used for either of these databasesin any previous release. Thus, there's no chance that an upgrade ofa cluster from any previous release will collide with the OIDs we'reassigning here. And going forward, the OIDs will always be fixed, sothe only potential collision is with a system database having thesame name and the same OID, which is OK.This patch lets users assign a specific OID to a database as well,provided however that it can't be less than 16384. I (rhaas) thoughtit might be better not to expose this capability to users, but theconsensus was otherwise, so the syntax is documented. Letting usersassign OIDs below 16384 would not be OK, though, because auser-created database with a low-numbered OID might collide with asystem-created database in a future release. We therefore prohibitthat.Shruthi KC, based on an earlier patch from Antonin Houska, reviewedand with some adjustments by me.Discussion:http://postgr.es/m/CA+TgmoYgTwYcUmB=e8+hRHOFA0kkS6Kde85+UNdon6q7bt1niQ@mail.gmail.comDiscussion:http://postgr.es/m/CAASxf_Mnwm1Dh2vd5FAhVX6S1nwNSZUB1z12VddYtM++H2+p7w@mail.gmail.com1 parent4f0bcc7 commitaa01051
File tree
11 files changed
+120
-22
lines changed- doc/src/sgml/ref
- src
- backend/commands
- bin
- initdb
- pg_dump
- pg_upgrade
- psql
- include
- access
- catalog
11 files changed
+120
-22
lines changedLines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
34 |
| - | |
| 34 | + | |
| 35 | + | |
35 | 36 |
| |
36 | 37 |
| |
37 | 38 |
| |
| |||
203 | 204 |
| |
204 | 205 |
| |
205 | 206 |
| |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
206 | 222 |
| |
207 | 223 |
| |
208 | 224 |
| |
|
Lines changed: 52 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
115 | 115 |
| |
116 | 116 |
| |
117 | 117 |
| |
118 |
| - | |
| 118 | + | |
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
| |||
215 | 215 |
| |
216 | 216 |
| |
217 | 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 | + | |
218 | 242 |
| |
219 | 243 |
| |
220 | 244 |
| |
| |||
502 | 526 |
| |
503 | 527 |
| |
504 | 528 |
| |
505 |
| - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
506 | 534 |
| |
507 |
| - | |
508 |
| - | |
509 |
| - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
510 | 557 |
| |
511 | 558 |
| |
512 | 559 |
| |
|
Lines changed: 20 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
| 62 | + | |
62 | 63 |
| |
63 | 64 |
| |
64 | 65 |
| |
| |||
1838 | 1839 |
| |
1839 | 1840 |
| |
1840 | 1841 |
| |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
1841 | 1856 |
| |
1842 |
| - | |
| 1857 | + | |
| 1858 | + | |
1843 | 1859 |
| |
1844 | 1860 |
| |
1845 | 1861 |
| |
| |||
1869 | 1885 |
| |
1870 | 1886 |
| |
1871 | 1887 |
| |
| 1888 | + | |
| 1889 | + | |
1872 | 1890 |
| |
1873 |
| - | |
| 1891 | + | |
1874 | 1892 |
| |
1875 | 1893 |
| |
1876 | 1894 |
| |
|
Lines changed: 10 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2838 | 2838 |
| |
2839 | 2839 |
| |
2840 | 2840 |
| |
2841 |
| - | |
2842 |
| - | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
2843 | 2851 |
| |
2844 | 2852 |
| |
2845 | 2853 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
89 |
| - | |
| 89 | + | |
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
|
Lines changed: 3 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
190 | 190 |
| |
191 | 191 |
| |
192 | 192 |
| |
193 |
| - | |
194 |
| - | |
195 |
| - | |
196 |
| - | |
| 193 | + | |
| 194 | + | |
197 | 195 |
| |
198 | 196 |
| |
199 | 197 |
| |
| |||
324 | 322 |
| |
325 | 323 |
| |
326 | 324 |
| |
327 |
| - | |
328 |
| - | |
| 325 | + | |
329 | 326 |
| |
330 | 327 |
| |
331 | 328 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
148 |
| - | |
149 |
| - | |
| 148 | + | |
150 | 149 |
| |
151 | 150 |
| |
152 | 151 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
193 | 193 |
| |
194 | 194 |
| |
195 | 195 |
| |
196 |
| - | |
| 196 | + | |
197 | 197 |
| |
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
201 | 201 |
| |
202 | 202 |
| |
203 |
| - | |
| 203 | + | |
204 | 204 |
| |
205 | 205 |
| |
206 | 206 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2633 | 2633 |
| |
2634 | 2634 |
| |
2635 | 2635 |
| |
2636 |
| - | |
| 2636 | + | |
2637 | 2637 |
| |
2638 | 2638 |
| |
2639 | 2639 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
199 | 203 |
| |
200 | 204 |
| |
201 | 205 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
35 | 44 |
| |
36 | 45 |
| |
37 | 46 |
| |
|
0 commit comments
Comments
(0)