diff options
author | Tom Lane | 2019-07-05 16:32:36 +0000 |
---|---|---|
committer | Tom Lane | 2019-07-05 16:32:36 +0000 |
commit | 02e95a5049f7933cbde1dacf401604ea3fc02aa5 (patch) | |
tree | a9d0c9c0645dbc17c16c2cba4c47d58eacc99b7e /src/test | |
parent | e8fdcacc6cbeed7d1a2175c5eddf0b162e0cb7c4 (diff) |
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/[email protected]
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/psql.out | 19 | ||||
-rw-r--r-- | src/test/regress/sql/psql.sql | 16 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out index 4bcf0cc5dfd..9021c808dcf 100644 --- a/src/test/regress/expected/psql.out +++ b/src/test/regress/expected/psql.out @@ -4180,6 +4180,25 @@ drop table psql_serial_tab; \pset format aligned \pset expanded off \pset border 1 +-- \echo and allied features +\echo this is a test +this is a test +\echo -n without newline +without newline\echo with -n newline +with -n newline +\echo '-n' with newline +-n with newline +\set foo bar +\echo foo = :foo +foo = bar +\qecho this is a test +this is a test +\qecho foo = :foo +foo = bar +\warn this is a test +this is a test +\warn foo = :foo +foo = bar -- tests for \if ... \endif \if true select 'okay'; diff --git a/src/test/regress/sql/psql.sql b/src/test/regress/sql/psql.sql index 26f436ae403..cefe41bdc2e 100644 --- a/src/test/regress/sql/psql.sql +++ b/src/test/regress/sql/psql.sql @@ -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 |