Re: [COMMITTERS] pgsql: Mark JSON error detail messages for translation.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: [COMMITTERS] pgsql: Mark JSON error detail messages for translation.
Date: 2012-06-13 18:55:24
Message-ID: 14578.1339613724@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Jun 13, 2012 at 1:04 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>> ! DETAIL: Character with value 0x0a must be escaped.
>>> ! CONTEXT: JSON data, line 1: "abc
>>> ! ...
>>>
>>> This seems an odd way to present this, especially if the goal is to
>>> NOT include the character needing escaping in the log unescaped, which
>>> I thought was the point of saying 0x0a.

>> Do you think it would be better to present something that isn't what the
>> user typed? Again, I don't see an easy improvement here. If you don't
>> want newlines in the logged context, what will we do for something like
>>
>> {"foo": {
>> "bar":44
>> }
>> ]

> Hmm. If your plan is to trace back to the opening brace you were
> expecting to match, I don't think that's going to work either. What
> if there are three pages (or 3MB) of data in between?

No, that's not the proposal; I only anticipate printing a few dozen
characters of context. But that could still mean printing something
like

DETAIL: expected "," or "}", but found "]".
CONTEXT: JSON data, line 123: ..."bar":44
}
]

which I argue is much more useful than just seeing the "]". So the
question is whether it's still as useful if we mangle the whitespace.
I'm thinking it's not. We don't mangle whitespace when printing SQL
statements into the log, anyway.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-06-13 19:33:31 Re: Re: [COMMITTERS] pgsql: Send new protocol keepalive messages to standby servers.
Previous Message Robert Haas 2012-06-13 18:09:19 Re: [COMMITTERS] pgsql: Mark JSON error detail messages for translation.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-06-13 18:56:58 Re: [COMMITTERS] pgsql: Add ERROR msg for GLOBAL/LOCAL TEMP is not yet implemented
Previous Message Christopher Browne 2012-06-13 18:50:42 Re: [PATCH 14/16] Add module to apply changes from an apply-cache using low-level functions