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 1hejWa-0006M6-Ml for pgsql-general@arkaria.postgresql.org; Sat, 22 Jun 2019 17:10:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hejWZ-0007SF-HU for pgsql-general@arkaria.postgresql.org; Sat, 22 Jun 2019 17:09:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hejWZ-0007PU-12 for pgsql-general@lists.postgresql.org; Sat, 22 Jun 2019 17:09:59 +0000 Received: from mout.gmx.net ([212.227.17.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hejWR-0005CU-EU for pgsql-general@lists.postgresql.org; Sat, 22 Jun 2019 17:09:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1561223385; bh=UiubaermMtCqYRpoZqoe6+8AD37IBQAwGU7gggo0UgI=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=HdkffWopcMYQrOYWaXxFiPKhySOe+m71P6ARXfv696rMb1YijGVs0PKHyKoyro80O IjqwzhOFPcohO3GB0ANVSYm5aUoiHEFyDHa27WujIqp6Aj7Syu/lq5+Usoa2oLB6qF 2B124l+BvEUmLaPr7IwsbME6RwSYc2mu9zBMUnMk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([77.183.110.64]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MrQEx-1iPsmU1AIx-00oVks for ; Sat, 22 Jun 2019 19:09:45 +0200 Received: from ncq by hermes with local (Exim 4.92) (envelope-from ) id 1hejWI-0003af-Fr for pgsql-general@lists.postgresql.org; Sat, 22 Jun 2019 19:09:42 +0200 Date: Sat, 22 Jun 2019 19:09:41 +0200 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: Row data is reflected in DETAIL message when constraints fail on insert/update Message-ID: <20190622170941.GA9847@hermes.hilbert.loc> References: <20190620114527.GD30366@hermes.hilbert.loc> <20190620152741.GG30366@hermes.hilbert.loc> <13631.1561047413@sss.pgh.pa.us> <20190621095754.GA2222@hermes.hilbert.loc> <20190622164010.vsyjjkihio4tfz5i@hjp.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190622164010.vsyjjkihio4tfz5i@hjp.at> Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) User-Agent: Mutt/1.10.1 (2018-07-13) Sender: X-Provags-ID: V03:K1:B4eqHH8u5D8EeoV21PXAnYdcrYHYzbfuqKcySC9ATyhPsCm6CfH VrxmTwkgseEXbc8ObUuOekpKf0m1cyESzrqLK25krNgPowUvclBzsfW7WLLXuF+gQqp3CgU +l80n4P4rNLkgnh0OpfaJROy4qlYCfhAZnNcEeBL1g4D1MzifGLA8bhtMjm9AH3oTI6yfmw 6uz6TIyybqDbb0d07l1TA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:U/5I/KmHMds=:uaf+9CPbb3Z+/g4CRfhU1d 2HGgzERzYLNlvvFEWjHt7gbuzKLS54GZLf4mzl2d749+pKcvP3t/umJXW4PULRT9LRKnjfjyz J7K5MiJHMR931auqTjdjysaRYqgHEsYX3YulFz2unzl3/G0eBzf/o6/fQMY6cw0+kAgltoKBx J0EceaDMC5XZHgfACwjtENBWdZEjJaWtGM9FLrCbwocadr7ELvEdV2twZcH9u/CIMKspXDZ1H PzsvmL0grsNVkRDY20ijBxO/FxZzEcf81FteMM8pX48JlIX7bWWfx7tiSPx5MiqIyXAvyHT1i qUsp9o3cbrtMCyThQBGjKFXr8+Wo18p0/eltayiEuNFUDVlD4W/5IVHJ61Wt0FDWELgJ76wwO HvkDkg38dzI8mUwpkVyVKBc/KRWHn0p34veo2P6ZBN0vSow7W0ymciae5aIOWJKXunASfJ9s4 iznfhBbxO0/oJcwPpDaHo8y5z0o1BU+Ihet28ynwO7i2Tijh8LiKgDozBvDGZrZrDmyMVVlWy zs9hQ/kmFTUmimYIud+l3wLBbCj0ZSva6aD3f7c6I5Aqeq51nWzQZHzobjiiTCowWEMmFDLa3 ie8gyM/P3BgL2AGwSfZQ58VH2OoSeHbPv/mkERnLRo+a2CkyvZN7dxqe7Rw4WyZ2Z2qoDgCtJ X+cjsB0OB2ilr433tn7OdUmyzGh13IC5t5nzpMXjE3psFffLvqIGhv9cKd+RMzlCHk/x3YdhJ rpGb2DYcoJ461igAqurBpfMiJFj0XlFpeHMkpvlNVmn/YZh7q/PAuoPEktlCcjy30baDGZYK6 mVQ9m/+pwow2X1nCUr3RjejWvP4jHjZCIKCRmtnRbWt4Z/8tPxLXl5ixky0LB2UmBmfFyk0sy nmjFC6R1ThKZzNDec3ajHNy3X5rcf2MbAxLNHSJYelSDo2oRH50l9QskGLk811B+a84u4z49K cxbcHC2Gug0DU7WgnFHhTqSFenrqO2FM= Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Jun 22, 2019 at 06:40:10PM +0200, Peter J. Holzer wrote: > > How is it useful in a normally configured database to return row data = in > > error messages? > > This is extremely useful. It tells you what data didn't match your > program's expectations. Otherwise you just get a vague "unique > constraint violation" Sure, except some argue that PG not send such information to the *client* by *default*, which seems to have some merit (the default should, however, keep logging such data to the PG log) This can lead to the following problem: > and you can then search through a hundred million > rows of data to find that violation. which could be solved by passing to the client an identifier instead of the row data which is also logged to the server log alongside the row data. The combination of %m or %n - timestamp %c - session ID %l - in-session log line idx %e - SQLSTATE would probably suffice if sent to the client, given it is logged in the server log. (not that I suggest any such thing as I certainly lack the skills to provide a patch) Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B