Re: [PATCH v1] Add \echo_stderr to psql

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: David Fetter <david@fetter.org>
Cc: Corey Huinker <corey.huinker@gmail.com>, PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2019-04-27T20:09:27Z
Lists: pgsql-hackers
Hello David,

About v3. Applies, compiles, global & local make check are ok. doc gen ok.

>> I'd put the commands in alphabetical order (echo, qecho, warn) instead of
>> e/w/q in the condition.
>
> Done.

Cannot see it:

   + else if (strcmp(cmd, "echo") == 0 || strcmp(cmd, "warn") == 0 || strcmp(cmd, "qecho") == 0)

>> The -n trick does not appear in the help lines, ISTM that it could fit, so
>> maybe it could be added, possibly something like:
>>
>>  \echo [-n] [TEXT]  write string to stdout, possibly without trailing newline
>>
>> and same for \warn and \qecho?
>
> Makes sense, but I put it there just for \echo to keep lines short.

I think that putting together the 3 echo variants help makes sense, but 
maybe someone will object about breaking the abc order.

>>> How might we test this portably?
>>
>> Hmmm... TAP tests are expected to be portable. Attached a simple POC, which
>> could be extended to test many more things which are currently out of
>> coverage (src/bin/psql stuff is covered around 40% only).
>
> Thanks for putting this together. I've added this test, and agree that
> increasing coverage is important for another patch.

Yep.

-- 
Fabien.



Commits

  1. Add \warn command to psql.