Skip to content

Commit 34f34a0

Browse files
committed
Fix pg_ctl -w to properly wait on server startup.
1 parent 3bd7263 commit 34f34a0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/bin/pg_ctl/pg_ctl.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.24 2004/07/29 16:11:11 momjian Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.25 2004/08/21 03:12:55 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -404,12 +404,23 @@ test_postmaster_connection(void)
404404

405405
for (i = 0; i < wait_seconds; i++)
406406
{
407-
if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL, "template1", NULL, NULL)) != NULL)
407+
if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL,
408+
"template1", NULL, NULL)) != NULL &&
409+
PQstatus(conn) == CONNECTION_OK)
408410
{
409411
PQfinish(conn);
410412
success = true;
411413
break;
412414
}
415+
else
416+
{
417+
if (!silence_echo)
418+
{
419+
printf(".");
420+
fflush(stdout);
421+
}
422+
pg_usleep(1000000); /* 1 sec */
423+
}
413424
}
414425

415426
return success;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy