Fabien COELHO <coe...@cri.ensmp.fr> writes: > [ psql-echo-2.patch ]
I went to commit this, figuring that it was a trivial bit of code consolidation, but as I looked around in common.c I got rather unhappy with the inconsistent behavior of things. Examining the various places that implement "echo"-related logic, we have the three places this patch proposes to unify, which log queries using fprintf(out, _("********* QUERY **********\n" "%s\n" "**************************\n\n"), query); and then we have two more that just do puts(query); plus this: if (!OK && pset.echo == PSQL_ECHO_ERRORS) pg_log_info("STATEMENT: %s", query); So it's exactly fifty-fifty as to whether we add all that decoration or none at all. I think if we're going to touch this logic, we ought to try to unify the behavior. My vote would be to drop the decoration everywhere, but perhaps there are votes not to? A different angle is that the identical decoration is used for both psql-generated queries that are logged because of ECHO_HIDDEN, and user-entered queries. This seems at best rather unhelpful. If we keep the decoration, should we make it different for those two cases? (Maybe "INTERNAL QUERY" vs "QUERY", for example.) The cases with no decoration likewise fall into multiple categories, both user-entered and generated-by-gexec; if we were going with a decorated approach I'd think it useful to make a distinction between those, too. Thoughts? regards, tom lane