Re: log bind parameter values on error

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Alexey Bashtanov <bashtanov(at)imap(dot)cc>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: log bind parameter values on error
Date: 2019-01-02 21:06:23
Message-ID: c4891f99-8385-5c31-1aac-e226356ec964@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 15/12/2018 00:04, Alexey Bashtanov wrote:
> I'd like to propose a patch to log bind parameter values not only when
> logging duration,
> but also on error (timeout in particular) or in whatever situation the
> statement normally gets logged.
> This mostly could be useful when the request originator doesn't log them
> either, so it's hard
> to reproduce the problem.

That's a reasonable problem to solve.

> So I decided to cache textual representations on bind stage,
> which is especially easy if the client uses text protocol.

That sounds like a plausible approach. Have you done any performance
measurements?

In your patch, I would organize the changes to the portal API a bit
differently. Don't change the signature of CreatePortal(). Get rid of
PortalSetCurrentTop() and PortalClearCurrentTop(). Just have a global
variable CurrentPortal and set it directly. And then change
GetCurrentPortalBindParameters() to take a Portal as argument. This can
all happen inside postgres.c without changing the Portal APIs.

In fact, maybe don't use the Portal structure at all and just store the
saved textualized values inside postgres.c in a static variable.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-02 21:10:14 Re: [PATCH] Log PostgreSQL version number on startup
Previous Message Stephen Frost 2019-01-02 20:59:50 Re: Is MinMaxExpr really leakproof?