Peter Eisentraut writes:
> I wonder whether this mix of HELP0 and HELP is necessary. The original
> code didn't care about calling fprintf even if there are no
> substitutions. I think this could lead to misalignment errors. I
> vaguely recall we once had mixes of fprintf and fputs and got r
On 03.06.22 22:51, Tom Lane wrote:
+ HELP0(" -c, --command=COMMANDrun only single command (SQL or internal)
and exit\n");
+ HELP(" -d, --dbname=DBNAME database name to connect to (default:
\"%s\")\n",
+env);
I wonder whether this mix of HELP0 and HELP is
Alvaro Herrera writes:
> What about adding stringInfoCountLines or something like that?
If we have other use-cases, maybe that'd be worthwhile.
(In the committed patch, I dumbed it down to a plain per-char
loop without the strchr() complication. So it's very little code.
I'm not real sure that
On 2022-Jun-03, Tom Lane wrote:
> So, attached is a patch to remove that maintenance chore by
> constructing the output in a PQExpBuffer and then counting the
> lines automatically. While I was at it, I introduced a couple of
> macros to make the code shorter rather than longer.
What about addin
Robert Haas writes:
> On Fri, Jun 3, 2022 at 4:51 PM Tom Lane wrote:
>> Thoughts?
> +1 from me. Wish we'd done this years ago.
Pushed, thanks for looking at it.
regards, tom lane
On Fri, Jun 3, 2022 at 4:51 PM Tom Lane wrote:
> Thoughts?
+1 from me. Wish we'd done this years ago.
--
Robert Haas
EDB: http://www.enterprisedb.com
I finally reached the point of being fed up with our inability
to maintain the number of lines output by psql's usage() and
sibling functions. Almost every year, we find ourselves updating
those magic constants sometime late in the dev cycle, and I just
had to do it again today.
So, attached is a