diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 2a2765645e4803a91e73a6db2a28cd0ac6af9419..0a648e72e1792fbb70c7c204c7a4b8265ed3c395 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -30,7 +30,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.9 2010/02/26 02:00:58 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.10 2010/03/16 09:09:55 heikki Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -119,6 +119,11 @@ WalSenderMain(void)
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 				 errmsg("must be superuser to start walsender")));
 
+	if (RecoveryInProgress())
+		ereport(FATAL,
+				(errcode(ERRCODE_CANNOT_CONNECT_NOW),
+				 errmsg("recovery is still in progress, can't accept WAL streaming connections")));
+
 	/* Create a per-walsender data structure in shared memory */
 	InitWalSnd();