Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: pg_ctl strangeness under msys


  • From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
  • To: Andrew Dunstan <andrew(at)dunslane(dot)net>
  • Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, pgsql-hackers-win32 <pgsql-hackers-win32(at)postgresql(dot)org>
  • Subject: Re: pg_ctl strangeness under msys
  • Date: Wed, 27 Oct 2004 15:43:55 -0400 (EDT)
  • Message-id: <200410271943(dot)i9RJhtx01465(at)candle(dot)pha(dot)pa(dot)us>

Andrew Dunstan wrote:
> >Have you tried:
> >
> >	pg_ctl start 2>/dev/tty
> >
> >that would force stderr to go to the tty.  This might help because the
> >pg_ctl.c test is:
> >
> >	    if (!isatty(fileno(stderr)))    /* Running as a service */
> >
> >  
> >
> 
> This was about status, not start.
> 
>   pg_ctl status 2>/dev/tty
> 
> gives me the same thing as before. But only if the postmaster isn't 
> running - if it is running I get the status as expected, because then we 
> write to stdout rather than calling write_stderr() - I'm not sure I 
> understand why we do that.

Yes, that is a bug that is fixed with the applied patch.  We should
alway print status to stdout, even stopped status.  We did that in 7.4
and should continue with that in 8.0.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.43
diff -c -c -r1.43 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c	27 Oct 2004 17:17:07 -0000	1.43
--- src/bin/pg_ctl/pg_ctl.c	27 Oct 2004 19:43:01 -0000
***************
*** 767,786 ****
  	pid = get_pgpid();
  	if (pid == 0)				/* no pid file */
  	{
! 		write_stderr(_("%s: neither postmaster nor postgres running\n"), progname);
  		exit(1);
  	}
  	else if (pid < 0)			/* standalone backend */
  	{
  		pid = -pid;
! 		fprintf(stdout, _("%s: a standalone backend \"postgres\" is running (PID: %ld)\n"), progname, pid);
  	}
  	else
  	/* postmaster */
  	{
  		char	  **optlines;
  
! 		fprintf(stdout, _("%s: postmaster is running (PID: %ld)\n"), progname, pid);
  
  		optlines = readfile(postopts_file);
  		if (optlines != NULL)
--- 767,786 ----
  	pid = get_pgpid();
  	if (pid == 0)				/* no pid file */
  	{
! 		printf(_("%s: neither postmaster nor postgres running\n"), progname);
  		exit(1);
  	}
  	else if (pid < 0)			/* standalone backend */
  	{
  		pid = -pid;
! 		printf(_("%s: a standalone backend \"postgres\" is running (PID: %ld)\n"), progname, pid);
  	}
  	else
  	/* postmaster */
  	{
  		char	  **optlines;
  
! 		printf(_("%s: postmaster is running (PID: %ld)\n"), progname, pid);
  
  		optlines = readfile(postopts_file);
  		if (optlines != NULL)


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group