David Steele <da...@pgmasters.net> writes: > On 3/10/16 11:00 AM, Petr Jelinek wrote: >> The comment above errhidefromclient says "Only log levels below ERROR >> can be hidden from the client." but use of the errhidefromclient(true) >> actually does hide the error message from client, client just gets >> failed query without any message when used with ERROR level.
> Right you are. The v3 patch adds this check. > I also added the documentation to sources.sgml that Tom pointed out was > missing. I set to work on committing this, but was soon rather dissatisfied with it, because as-implemented there is no way to short-circuit elog.c's processing if the message is not to be sent to either the client or the postmaster log. Ideally this would be taken into account when errstart() figures the output_to_client setting to begin with --- but of course we can't do that with this API, because errhidefromclient() hasn't run yet. The patch is buggy even without that consideration, because it would potentially disable client output of messages even after they've been promoted to FATAL by pg_re_throw. We could fix that by clearing the flag in pg_re_throw, but I think that's just another symptom of the shutoff being done in the wrong place. I wonder just what the expected usage scenario is for this function, and whether it would not be better addressed by inventing some other API rather than modeling it on errhidestmt(), which is by no means the same kind of thing. One idea is to invent a new elevel which is never sent to the client --- analogously to COMMERROR, though probably much higher priority than that, maybe the same priority as LOG. If there actually is a use for a range of elevels on errhidefromclient'd messages, that wouldn't work very well of course. Or we could consider having a flag bit that is OR'd into the elevel, along the lines of ereport(LOG | ERR_HIDE_FROM_CLIENT, (errmsg(....))); so that the information is available at errstart time. regards, tom lane -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers