diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index eef6e4b..a309109 100644
*** a/src/bin/psql/command.c
--- b/src/bin/psql/command.c
*************** static bool
*** 3020,3026 ****
  do_watch(PQExpBuffer query_buf, long sleep)
  {
  	printQueryOpt myopt = pset.popt;
! 	char		title[50];
  
  	if (!query_buf || query_buf->len <= 0)
  	{
--- 3020,3029 ----
  do_watch(PQExpBuffer query_buf, long sleep)
  {
  	printQueryOpt myopt = pset.popt;
! 	const char	 *user_title;
! 	char		 *title;
! 	int			  title_len;
! 	int			  res = 0;
  
  	if (!query_buf || query_buf->len <= 0)
  	{
*************** do_watch(PQExpBuffer query_buf, long sle
*** 3034,3042 ****
  	 */
  	myopt.topt.pager = 0;
  
  	for (;;)
  	{
- 		int			res;
  		time_t		timer;
  		long		i;
  
--- 3037,3055 ----
  	 */
  	myopt.topt.pager = 0;
  
+ 	/*
+ 	 * If there's a title in the user configuration, make sure we have room
+ 	 * for it in the title buffer.
+ 	 */
+ 	user_title = myopt.title;
+ 	if (user_title)
+ 		title_len = strlen(user_title) + 50;
+ 	else
+ 		title_len = 50;
+ 	title = pg_malloc(title_len);
+ 
  	for (;;)
  	{
  		time_t		timer;
  		long		i;
  
*************** do_watch(PQExpBuffer query_buf, long sle
*** 3045,3052 ****
  		 * of completion of the command?
  		 */
  		timer = time(NULL);
! 		snprintf(title, sizeof(title), _("Watch every %lds\t%s"),
! 				 sleep, asctime(localtime(&timer)));
  		myopt.title = title;
  
  		/* Run the query and print out the results */
--- 3058,3071 ----
  		 * of completion of the command?
  		 */
  		timer = time(NULL);
! 		if (user_title)
! 			snprintf(title, title_len,
! 					 "%s\t%s",
! 					 user_title, asctime(localtime(&timer)));
! 		else
! 			snprintf(title, title_len,
! 					 _("Watch every %lds\t%s"),
! 					 sleep, asctime(localtime(&timer)));
  		myopt.title = title;
  
  		/* Run the query and print out the results */
*************** do_watch(PQExpBuffer query_buf, long sle
*** 3056,3065 ****
  		 * PSQLexecWatch handles the case where we can no longer repeat the
  		 * query, and returns 0 or -1.
  		 */
! 		if (res == 0)
  			break;
- 		if (res == -1)
- 			return false;
  
  		/*
  		 * Set up cancellation of 'watch' via SIGINT.  We redo this each time
--- 3075,3082 ----
  		 * PSQLexecWatch handles the case where we can no longer repeat the
  		 * query, and returns 0 or -1.
  		 */
! 		if (res == 0 || res == -1)
  			break;
  
  		/*
  		 * Set up cancellation of 'watch' via SIGINT.  We redo this each time
*************** do_watch(PQExpBuffer query_buf, long sle
*** 3084,3090 ****
  		sigint_interrupt_enabled = false;
  	}
  
! 	return true;
  }
  
  /*
--- 3101,3108 ----
  		sigint_interrupt_enabled = false;
  	}
  
! 	pg_free(title);
! 	return (res >= 0);
  }
  
  /*
