Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieMQg-0000Oe-Oy for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Dec 2019 17:02:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ieMQe-0007G9-OH for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Dec 2019 17:02:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieMQe-0007G0-Ay for pgsql-hackers@lists.postgresql.org; Mon, 09 Dec 2019 17:02:36 +0000 Received: from mail-vk1-xa2e.google.com ([2607:f8b0:4864:20::a2e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieMQa-00051e-WE for pgsql-hackers@postgresql.org; Mon, 09 Dec 2019 17:02:35 +0000 Received: by mail-vk1-xa2e.google.com with SMTP id u6so4604997vkn.13 for ; Mon, 09 Dec 2019 09:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=ufXr8DO2bGR2vbpLkPmuYuDO4pBAhG54qD3J8lGYoyQ=; b=nWa9FgfRsIXbkoQpsKlxUrNSvODAfPDU6E7KiPeJwI26SCA3cZ2M4IV5U+3ISm0PqQ daSVFd88nYqdKuzpol21nvx7OvnckvsK4kR9juSi1zpIGcdixpFwgRzYXgcz9PgzQqzP EN8ojuID1Tdn8A4mGNlk02w1ya3frpsh5IE1pXNYOmZM7ypg2JOjwlKL6iI0XvjMqPaX UGiYiFXMW2Qqdc18g603p1H4QX+jjAnzKGDNckr0w2frLxSqFL+qqxeOhH+GF/y/Hsrx EOHQEMIZ6xbvLH9HH6DQ8MPCjWP2/LUR0/5ssbC79YRUE/9eHSnI9phP7IRIvd6NE2/Q He4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ufXr8DO2bGR2vbpLkPmuYuDO4pBAhG54qD3J8lGYoyQ=; b=Rua62YbNzcn/EMFv+zhJV9EBAKjkwlZ7XUnhO5/gCCMWoat79RQpAJjFNCMWIvmBSy ZltwwrvjBEwcl2eHLAWnKYjY4TO8qHu8R3egTwjjkr471Cs7/79DTPF+VWQiKPnQF0kR OmrcKYnczG3j4ljYHSHfRm+MoC5uZsZXEAVUPfxIsTIxQGTULwvo7jdo55XoLgdQ9Z5h QrR5HMSvjnWrh/j53xfeGfDmmScKDG9Mdp/AUezBweYFu/tY9Jf6/pCeutdid+VKWnvK AgWi8j4O0yBDhOg4ufQ+8pP52ofh04O8WyoiN+ZMN7RLncICTGGfwYVlLNSKnpEJyb7u xdyQ== X-Gm-Message-State: APjAAAV4yoGCm0bt0HWCAD7r2EeJ1aNImoC1yA6kQezZlcEwY8EwRb6/ 0697nGrN7VibgjoUl10HSPyVsg== X-Google-Smtp-Source: APXvYqxmD5og1OpY8GsvV95yLAt16MYBvp8/Sk5H2GLmm4dAIzjc0MCs4Cu5OnPnEbHxFafUlN+c+A== X-Received: by 2002:ac5:c99c:: with SMTP id e28mr24669727vkm.52.1575910951054; Mon, 09 Dec 2019 09:02:31 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id e16sm132130vso.32.2019.12.09.09.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 09:02:29 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 079623008E7; Mon, 9 Dec 2019 14:02:26 -0300 (-03) Date: Mon, 9 Dec 2019 14:02:26 -0300 From: Alvaro Herrera To: Tom Lane Cc: Andres Freund , Alexey Bashtanov , Peter Eisentraut , PostgreSQL Hackers Subject: Re: log bind parameter values on error Message-ID: <20191209170225.GA26084@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <16839.1575754825@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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