summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-08-21 03:12:55 +0000
committerBruce Momjian <bruce@momjian.us>2004-08-21 03:12:55 +0000
commit34f34a041c723e50e532383793ce16655c859aea (patch)
treed10a956ed2a8337b70f7ec9784d34d3c0ed08927
parent3bd726333c296df1abe3a9248bef8cc3d43ed87a (diff)
Fix pg_ctl -w to properly wait on server startup.
-rw-r--r--src/bin/pg_ctl/pg_ctl.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index d49338f4903..a388fd72be9 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.24 2004/07/29 16:11:11 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.25 2004/08/21 03:12:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -404,12 +404,23 @@ test_postmaster_connection(void)
for (i = 0; i < wait_seconds; i++)
{
- if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL, "template1", NULL, NULL)) != NULL)
+ if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL,
+ "template1", NULL, NULL)) != NULL &&
+ PQstatus(conn) == CONNECTION_OK)
{
PQfinish(conn);
success = true;
break;
}
+ else
+ {
+ if (!silence_echo)
+ {
+ printf(".");
+ fflush(stdout);
+ }
+ pg_usleep(1000000); /* 1 sec */
+ }
}
return success;