1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

Add \warn command to psql.

This is like \echo except that the text is sent to stderr not stdout.

In passing, fix a pre-existing bug in \echo and \qecho: per documentation
the -n switch should only be recognized when it is the first argument,
but actually any argument matching "-n" was treated as a switch.
(Should we back-patch that?)

David Fetter (bug fix by me), reviewed by Fabien Coelho

Discussion: https://postgr.es/m/20190421183115.GA4311@fetter.org
This commit is contained in:
Tom Lane
2019-07-05 12:32:36 -04:00
parent e8fdcacc6c
commit 02e95a5049
6 changed files with 62 additions and 11 deletions

View File

@@ -771,6 +771,22 @@ drop table psql_serial_tab;
\pset expanded off
\pset border 1
-- \echo and allied features
\echo this is a test
\echo -n without newline
\echo with -n newline
\echo '-n' with newline
\set foo bar
\echo foo = :foo
\qecho this is a test
\qecho foo = :foo
\warn this is a test
\warn foo = :foo
-- tests for \if ... \endif
\if true