Re: psql - factor out echo code

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, vignesh C <vignesh21(at)gmail(dot)com>, Shinya11(dot)Kato(at)nttdata(dot)com, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql - factor out echo code
Date: 2022-07-24 20:23:39
Message-ID: CAFj8pRAhNvEfU0nnKTWa1qdYfdG_tEyBnOE4=4t0R6HR_rKjQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

ne 24. 7. 2022 v 21:39 odesílatel Fabien COELHO <coelho(at)cri(dot)ensmp(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-07-24 20:59:37 012_subtransactions.pl vs clang -fsanitize=undefined
Previous Message Fabien COELHO 2022-07-24 19:42:48 Re: [PATCH] Introduce array_shuffle() and array_sample()