Re: log bind parameter values on error

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Alexey Bashtanov <bashtanov(at)imap(dot)cc>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: log bind parameter values on error
Date: 2019-12-09 17:02:26
Message-ID: 20191209170225.GA26084@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Dec-07, Tom Lane wrote:

> 0001:

> It is a very bad idea that this is truncating text without regard to
> multibyte character boundaries.

Hmm. So it turns out that we recently made stringinfo.c exported to
frontends in libpgcommon. Clipping strings at a given character size
means we need some facility like pg_encoding_mbcliplen.

However, 1) pgcommon does not have wchar.c (libpq does have it), and 2)
mbcliplen is not in wchar.c anyway.

I see four possible ways forward, with nuances. In order of preference:

1. change enough of the build system so that pg_encoding_mbcliplen is
available. (Offhand I see no reason why we couldn't move the
function from mbutils.c to wchar.c, but I haven't tried.)

2. in frontend, ignore the specified length; always copy the whole
string.

3. don't allow length clipping in frontend. (We have no use for it
in the near future.)
3a. Throw a run-time error if it's requested.
3b. throw a compile-time error if requested

4. don't provide this new function #if FRONTEND

--
Álvaro Herrera https://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 Finnerty, Jim 2019-12-09 17:05:39 Re: Corruption with duplicate primary key
Previous Message Robert Haas 2019-12-09 16:59:23 Re: [Proposal] Level4 Warnings show many shadow vars