Re: psql - factor out echo code - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: psql - factor out echo code
Date
Msg-id CAFj8pRAhNvEfU0nnKTWa1qdYfdG_tEyBnOE4=4t0R6HR_rKjQQ@mail.gmail.com
Whole thread Raw
In response to Re: psql - factor out echo code  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: psql - factor out echo code
List pgsql-hackers
Hi


ne 24. 7. 2022 v 21:39 odesílatel Fabien COELHO <coelho@cri.ensmp.fr> napsal:

>> Attached v4 simplifies the format and fixes this one.
>
> I think this goes way way overboard in terms of invasiveness. There's no
> need to identify individual call sites of PSQLexec. [...]

ISTM that having the information was useful for the user who actually
asked for psql to show hidden queries, and pretty simple to get, although
somehow invasive.

> It also looks like a mess from the translatibility standpoint.
> You can't expect "%s QUERY" to be a useful thing for translators.

Sure. Maybe I should have used an enum have a explicit switch in
echoQuery, but I do not like writing this kind of code.

Attached a v5 without hinting at the origin of the query beyond internal
or not.


I had just one question - with this patch, the format of output of modes ECHO ALL and ECHO QUERIES will be different, and that can be a little bit messy. On second hand, the prefix --QUERY can be disturbing in echo queries mode. It is not a problem in echo all mode, because queries and results are mixed together. So in the end, I think the current design can work.

All tests passed, this is trivial patch without impacts on users

I'll mark this patch as ready for committer

Regards

Pavel


pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [PATCH] Introduce array_shuffle() and array_sample()
Next
From: Justin Pryzby
Date:
Subject: 012_subtransactions.pl vs clang -fsanitize=undefined