Re: [PATCH v1] Add \echo_stderr to psql

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: David Fetter <david(at)fetter(dot)org>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH v1] Add \echo_stderr to psql
Date: 2019-04-27 14:05:20
Message-ID: alpine.DEB.2.21.1904271151260.29865@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello David,

> Please find attached v2, name is now \warn.

Patch applies cleanly, compiles, "make check ok", although there are no
tests. Doc gen ok.

Code is pretty straightforward.

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

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?

> 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).

--
Fabien.

Attachment Content-Type Size
psql-warn-2-tap.patch text/x-diff 2.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-04-27 14:47:13 Re: BUG #15781: subselect on foreign table (postgres_fdw) can crash (segfault)
Previous Message Etsuro Fujita 2019-04-27 13:30:37 Re: BUG #15781: subselect on foreign table (postgres_fdw) can crash (segfault)