|
32 | 32 | int WalSegSz;
|
33 | 33 |
|
34 | 34 | static bool RetrieveDataDirCreatePerm(PGconn *conn);
|
35 |
| -static char *FindDbnameInConnParams(PQconninfoOption *conn_opts); |
36 | 35 |
|
37 | 36 | /* SHOW command for replication connection was introduced in version 10 */
|
38 | 37 | #define MINIMUM_VERSION_FOR_SHOW_CMD 100000
|
@@ -269,74 +268,6 @@ GetConnection(void)
|
269 | 268 | return tmpconn;
|
270 | 269 | }
|
271 | 270 |
|
272 |
| -/* |
273 |
| - * FindDbnameInConnParams |
274 |
| - * |
275 |
| - * This is a helper function for GetDbnameFromConnectionOptions(). Extract |
276 |
| - * the value of dbname from PQconninfoOption parameters, if it's present. |
277 |
| - * Returns a strdup'd result or NULL. |
278 |
| - */ |
279 |
| -static char * |
280 |
| -FindDbnameInConnParams(PQconninfoOption *conn_opts) |
281 |
| -{ |
282 |
| - PQconninfoOption *conn_opt; |
283 |
| - |
284 |
| - for (conn_opt = conn_opts; conn_opt->keyword != NULL; conn_opt++) |
285 |
| - { |
286 |
| - if (strcmp(conn_opt->keyword, "dbname") == 0 && |
287 |
| - conn_opt->val != NULL && conn_opt->val[0] != '\0') |
288 |
| - return pg_strdup(conn_opt->val); |
289 |
| - } |
290 |
| - return NULL; |
291 |
| -} |
292 |
| - |
293 |
| -/* |
294 |
| - * GetDbnameFromConnectionOptions |
295 |
| - * |
296 |
| - * This is a special purpose function to retrieve the dbname from either the |
297 |
| - * connection_string specified by the user or from the environment variables. |
298 |
| - * |
299 |
| - * We follow GetConnection() to fetch the dbname from various connection |
300 |
| - * options. |
301 |
| - * |
302 |
| - * Returns NULL, if dbname is not specified by the user in the above |
303 |
| - * mentioned connection options. |
304 |
| - */ |
305 |
| -char * |
306 |
| -GetDbnameFromConnectionOptions(void) |
307 |
| -{ |
308 |
| - PQconninfoOption *conn_opts; |
309 |
| - char *err_msg = NULL; |
310 |
| - char *dbname; |
311 |
| - |
312 |
| - /* First try to get the dbname from connection string. */ |
313 |
| - if (connection_string) |
314 |
| - { |
315 |
| - conn_opts = PQconninfoParse(connection_string, &err_msg); |
316 |
| - if (conn_opts == NULL) |
317 |
| - pg_fatal("%s", err_msg); |
318 |
| - |
319 |
| - dbname = FindDbnameInConnParams(conn_opts); |
320 |
| - |
321 |
| - PQconninfoFree(conn_opts); |
322 |
| - if (dbname) |
323 |
| - return dbname; |
324 |
| - } |
325 |
| - |
326 |
| - /* |
327 |
| - * Next try to get the dbname from default values that are available from |
328 |
| - * the environment. |
329 |
| - */ |
330 |
| - conn_opts = PQconndefaults(); |
331 |
| - if (conn_opts == NULL) |
332 |
| - pg_fatal("out of memory"); |
333 |
| - |
334 |
| - dbname = FindDbnameInConnParams(conn_opts); |
335 |
| - |
336 |
| - PQconninfoFree(conn_opts); |
337 |
| - return dbname; |
338 |
| -} |
339 |
| - |
340 | 271 | /*
|
341 | 272 | * From version 10, explicitly set wal segment size using SHOW wal_segment_size
|
342 | 273 | * since ControlFile is not accessible here.
|
|
0 commit comments