pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ray Stell <stellr@cns.vt.edu>
Cc: alvherre <alvherre@commandprompt.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: command tag logging
Date: Thu, 27 May 2010 14:23:06 -0400
Message-ID: <4976.1274984586@sss.pgh.pa.us> (raw)
In-Reply-To: <20100527172547.GA9472@cns.vt.edu>
References: <20100526210833.GA14469@cns.vt.edu>
	<1274908611-sup-6661@alvh.no-ip.org>
	<3713.1274978989@sss.pgh.pa.us>
	<20100527172547.GA9472@cns.vt.edu>

Ray Stell <stellr@cns.vt.edu> writes:
> On Thu, May 27, 2010 at 12:49:49PM -0400, Tom Lane wrote:
>> That is in the right place, isn't it.  That would suggest that
>> get_ps_display() is returning a wrong length on Ray's machine.
>> It works okay here, but since that's platform-specific code that
>> hardly proves much.  Ray, what platform is this exactly?

> [postgres ~]$ cat /etc/issue
> Red Hat Enterprise Linux Server release 5.5 (Tikanga)

OK, I can reproduce it when I try on my Fedora box.  The problem is that
log_connections emits a log message before init_ps_display() has been
called, and the ps_status.c logic isn't careful to ensure that it
returns something sane in that case.  It accidentally failed to fail
too badly before I changed the elog.c logic, because there'd be an
embedded null after the program name in most cases.  I suppose people
might even have thought that printing "postmaster" or "postgres" for
%i was intended behavior there.

I think the most useful fix is to create a static variable to hold the
notional strlen(ps_buffer), which will initialize to zero, and then
we can use that instead of groveling over the string in get_ps_display.
Should improve performance a tad as well as fixing this problem.
Will work on that.

			regards, tom lane



view thread (8+ messages)  latest in thread

Message-ID: <4976.1274984586@sss.pgh.pa.us>
Permalink:  ../4976.1274984586@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4976.1274984586@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, stellr@cns.vt.edu, alvherre@commandprompt.com, pgsql-hackers@postgresql.org
  Subject: Re: command tag logging
  In-Reply-To: <4976.1274984586@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox