forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita45bc8a
committed
Fix handling of -d "connection string" in pg_dump/pg_restore.
Parallel pg_dump failed if its -d parameter was a connection stringcontaining any essential information other than host, port, or username.The same was true for pg_restore with --create.The reason is that these scenarios failed to preserve the connectionstring from the command line; the code felt free to replace that withjust the database name when reconnecting from a pg_dump parallel workeror after creating the target database. By chance, parallel pg_restoredid not suffer this defect, as long as you didn't say --create.In practice it seems that the error would be obvious only if theconnstring included essential, non-default SSL or GSS parameters.This may explain why it took us so long to notice. (It also makesit very difficult to craft a regression test case illustrating theproblem, since the test would fail in builds without those options.)Fix by refactoring so that ConnectDatabase always receives all therelevant options directly from the command line, rather thanreconstructed values. Inject a different database name, when necessary,by relying on libpq's rules for handling multiple "dbname" parameters.While here, let's get rid of the essentially duplicate _connectDBfunction, as well as some obsolete nearby cruft.Per bug #16604 from Zsolt Ero. Back-patch to all supported branches.Discussion:https://postgr.es/m/16604-933f4b8791227b15@postgresql.org1 parent55b7e2f commita45bc8a
File tree
6 files changed
+130
-281
lines changed- src/bin/pg_dump
6 files changed
+130
-281
lines changedLines changed: 20 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
61 | 75 |
| |
62 | 76 |
| |
63 | 77 |
| |
| |||
107 | 121 |
| |
108 | 122 |
| |
109 | 123 |
| |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
| 124 | + | |
| 125 | + | |
114 | 126 |
| |
115 |
| - | |
116 | 127 |
| |
117 | 128 |
| |
118 | 129 |
| |
| |||
127 | 138 |
| |
128 | 139 |
| |
129 | 140 |
| |
130 |
| - | |
131 |
| - | |
132 |
| - | |
133 |
| - | |
| 141 | + | |
134 | 142 |
| |
135 | 143 |
| |
136 | 144 |
| |
| |||
247 | 255 |
| |
248 | 256 |
| |
249 | 257 |
| |
250 |
| - | |
251 |
| - | |
252 |
| - | |
253 |
| - | |
254 |
| - | |
255 |
| - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
256 | 261 |
| |
257 | 262 |
| |
258 | 263 |
| |
|
Lines changed: 21 additions & 75 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
| 168 | + | |
168 | 169 |
| |
169 | 170 |
| |
170 | 171 |
| |
| |||
178 | 179 |
| |
179 | 180 |
| |
180 | 181 |
| |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
181 | 187 |
| |
182 | 188 |
| |
183 | 189 |
| |
| |||
410 | 416 |
| |
411 | 417 |
| |
412 | 418 |
| |
413 |
| - | |
414 |
| - | |
415 |
| - | |
| 419 | + | |
416 | 420 |
| |
417 | 421 |
| |
418 | 422 |
| |
| |||
832 | 836 |
| |
833 | 837 |
| |
834 | 838 |
| |
835 |
| - | |
836 |
| - | |
837 |
| - | |
838 |
| - | |
839 |
| - | |
840 |
| - | |
841 |
| - | |
842 | 839 |
| |
843 | 840 |
| |
844 |
| - | |
845 | 841 |
| |
846 | 842 |
| |
847 | 843 |
| |
| |||
973 | 969 |
| |
974 | 970 |
| |
975 | 971 |
| |
976 |
| - | |
| 972 | + | |
977 | 973 |
| |
978 | 974 |
| |
979 | 975 |
| |
| |||
2345 | 2341 |
| |
2346 | 2342 |
| |
2347 | 2343 |
| |
2348 |
| - | |
2349 |
| - | |
2350 | 2344 |
| |
2351 | 2345 |
| |
2352 | 2346 |
| |
| |||
3207 | 3201 |
| |
3208 | 3202 |
| |
3209 | 3203 |
| |
3210 |
| - | |
3211 |
| - | |
3212 | 3204 |
| |
3213 | 3205 |
| |
3214 | 3206 |
| |
3215 | 3207 |
| |
3216 | 3208 |
| |
3217 |
| - | |
| 3209 | + | |
3218 | 3210 |
| |
3219 | 3211 |
| |
3220 |
| - | |
3221 |
| - | |
3222 |
| - | |
| 3212 | + | |
3223 | 3213 |
| |
3224 |
| - | |
3225 |
| - | |
3226 |
| - | |
3227 |
| - | |
3228 |
| - | |
3229 |
| - | |
3230 |
| - | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
3231 | 3218 |
| |
3232 | 3219 |
| |
3233 | 3220 |
| |
| |||
4159 | 4146 |
| |
4160 | 4147 |
| |
4161 | 4148 |
| |
4162 |
| - | |
4163 |
| - | |
4164 |
| - | |
| 4149 | + | |
4165 | 4150 |
| |
4166 | 4151 |
| |
4167 | 4152 |
| |
| |||
4823 | 4808 |
| |
4824 | 4809 |
| |
4825 | 4810 |
| |
4826 |
| - | |
4827 |
| - | |
4828 |
| - | |
4829 |
| - | |
| 4811 | + | |
| 4812 | + | |
4830 | 4813 |
| |
4831 |
| - | |
4832 |
| - | |
4833 |
| - | |
4834 |
| - | |
4835 |
| - | |
4836 |
| - | |
4837 |
| - | |
4838 |
| - | |
4839 |
| - | |
4840 |
| - | |
| 4814 | + | |
4841 | 4815 |
| |
4842 |
| - | |
| 4816 | + | |
| 4817 | + | |
4843 | 4818 |
| |
4844 |
| - | |
4845 |
| - | |
4846 |
| - | |
4847 |
| - | |
4848 |
| - | |
4849 |
| - | |
4850 |
| - | |
4851 |
| - | |
4852 |
| - | |
4853 |
| - | |
4854 |
| - | |
4855 |
| - | |
4856 |
| - | |
4857 |
| - | |
4858 |
| - | |
4859 |
| - | |
4860 |
| - | |
4861 |
| - | |
4862 |
| - | |
4863 |
| - | |
4864 |
| - | |
4865 |
| - | |
4866 |
| - | |
4867 |
| - | |
4868 |
| - | |
4869 |
| - | |
4870 |
| - | |
4871 |
| - | |
4872 |
| - | |
4873 |
| - | |
| 4819 | + | |
4874 | 4820 |
| |
4875 | 4821 |
| |
4876 | 4822 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
303 | 303 |
| |
304 | 304 |
| |
305 | 305 |
| |
306 |
| - | |
307 | 306 |
| |
308 | 307 |
| |
309 | 308 |
| |
| |||
471 | 470 |
| |
472 | 471 |
| |
473 | 472 |
| |
474 |
| - | |
| 473 | + | |
475 | 474 |
| |
476 | 475 |
| |
477 | 476 |
| |
|
0 commit comments
Comments
(0)