From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: Alexey Bashtanov <bashtanov@imap.cc>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: log bind parameter values on error
Date: Wed, 4 Dec 2019 10:38:17 -0300
Message-ID: <20191204133817.GA27976@alvherre.pgsql> (raw)
In-Reply-To: <20191203211739.GA12872@alvherre.pgsql>
> (Maybe do strnlen(maxlen), then count strnlen(1) starting at that point
> -- so if that returns >=1, print the "..."?)
So I found that I can make the code more reasonable with this simple
coding,
if (maxlen > 0)
{
s = pnstrdup(s, maxlen);
ellipsis = strnlen(s, maxlen + 1) > maxlen;
/* enlarge while we can do so cheaply */
enlargeStringInfo(str, maxlen);
}
... but the problem is that we now compile stringinfo.c for frontend
environments also, and there's no pnstrdup() in frontends. And to
introduce it, we'd need a configure check (because GNU libc has it) and
a src/port naive implementation and a fe_memutils.c addition.
Sigh.
Still, it's not that much code, so I'll just go do that and open a
separate thread for it.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com, andres@anarazel.de, bashtanov@imap.cc, peter.eisentraut@2ndquadrant.com
Subject: Re: log bind parameter values on error
In-Reply-To: <20191204133817.GA27976@alvherre.pgsql>
* 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