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 1h10iI-0001ik-Ha for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Mar 2019 03:25:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h10iH-0005YK-7X for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Mar 2019 03:25:53 +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 1h10iG-0005YD-Sx for pgsql-hackers@lists.postgresql.org; Tue, 05 Mar 2019 03:25:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h10iE-0006Uy-7I for pgsql-hackers@postgresql.org; Tue, 05 Mar 2019 03:25:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x253PdCf005009; Mon, 4 Mar 2019 22:25:39 -0500 From: Tom Lane To: Robert Haas cc: "Iwata, Aya" , "Jamison, Kirk" , "Nagaura, Ryohei" , Jacob Champion , Jim Doty , PostgreSQL mailing lists , "nagata@sraoss.co.jp" , Haribabu Kommi , Peter Eisentraut Subject: Re: libpq debug log In-reply-to: References: <71E660EB361DF14299875B198D4CE5423DE3FBA4@g01jpexmbkw25> <20180827215124.0cdb4d0cb99136b5a86b1d9f@sraoss.co.jp> <71E660EB361DF14299875B198D4CE5423DE4A154@g01jpexmbkw25> <4bc9abbd-44a0-1787-b410-4e68b5ab3228@2ndquadrant.com> <71E660EB361DF14299875B198D4CE5423DE5ADB3@g01jpexmbkw25> <71E660EB361DF14299875B198D4CE5423DE758BB@g01jpexmbkw25> <71E660EB361DF14299875B198D4CE5423DE804A9@g01jpexmbkw25> <71E660EB361DF14299875B198D4CE5423DE82363@g01jpexmbkw25> <71E660EB361DF14299875B198D4CE5423DE83937@g01jpexmbkw25> <71E660EB361DF14299875B198D4CE5423DE99C79@g01jpexmbkw25> <71E660EB361DF14299875B198D4CE5423DEB31F4@g01jpexmbkw25> <71E660EB361DF14299875B198D4CE5423DEB9E4B@g01jpexmbkw25> <71E660EB361DF14299875B198D4CE5423DED92AD@g01jpexmbkw25> <71E66! 0EB361DF14299875B198D4CE5423DEDA4CF@g01jpexmbkw25> <19535.1550861516@sss.pgh.pa.us> <71E660EB361DF14299875B198D4CE5423DEF1844@g01jpexmbkw25> Comments: In-reply-to Robert Haas message dated "Mon, 04 Mar 2019 22:04:40 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5007.1551756339.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 04 Mar 2019 22:25:39 -0500 Message-ID: <5008.1551756339@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > The basic idea being: > - Each line is a whole message. > - The line begins with <<< for a message received and >>> for a message = sent. +1, though do we really need to repeat the direction marker thrice? > - Strings in single quotes are those sent/received as a fixed number of = bytes. > - Strings in double quotes are those sent/received as a string. > - 4-byte integers are printed unadorned. > - 2-byte integers are prefixed by #. > - I guess 1-byte integers would need some other prefix, maybe @ or ##. I doubt that anybody gives a fig for those distinctions, except when they're writing actual code that speaks the protocol --- and I do not think that that's the target use-case. So strings and integers seem like plenty. I'd also suggest that just because the protocol has single-letter codes for message types doesn't mean that average users have memorized those codes; and that framing data like the message length is of no interest. In short, rather than <<< 'T' 101 4 "Schema" 2615 #2 19 #64 -1 #0 "Name" 1259 #2 19 #64 -1 #0 "= Owner" 0 #0 19 #64 -1 #0 I'd envision something more like < RowDescription "Schema" 2615 2 19 64 -1 0 "Name" 1259 2 19 64 -1 0 "Own= er" 0 0 19 64 -1 0 > But I still don't really see a need for different levels or whatever. > I mean, you either want a dump of all of the protocol traffic, or you > don't, I think. Or maybe I am confused as to what the goal of all > this really is. Yeah, me too. But a lot of this detail would only be useful if you were trying to diagnose something like a discrepancy between the server and libpq as to the width of some field. And the number of users for that can be counted without running out of fingers. I think what would be of use for a trace facility is as high-level a view as possible of the message contents. Or, in other words: a large part of the problem with the existing PQtrace facility is that it *was* designed to help debug libpq itself, and that use-case is no longer very interesting. We should assume that the library knows how to parse protocol messages. regards, tom lane