diff --git a/src/test/regress/expected/estream.out b/src/test/regress/expected/estream.out
new file mode 100644
index 0000000..1461aed
--- /dev/null
+++ b/src/test/regress/expected/estream.out
@@ -0,0 +1,40 @@
+--
+-- Test of psql's \pset estream parameter.
+-- Don't use an actual table name since we might be running in parallel.
+--
+-- Bugs:
+--  o Uses /dev/null, which probably breaks on non-Unix boxes.
+--  o Due to the nature of the test framework, never looks at
+--    what's saved to the output file.  Instead tests what's
+--    missing from stdout/stderr.
+--
+\o /dev/null
+-- This should not send an error into the output file, but
+-- should send it to stderr.
+select * from f oo;
+ERROR:  relation "f" does not exist
+LINE 1: select * from f oo;
+                      ^
+-- This should send an error into the output file, but not stderr.
+\pset estream query
+select * from f oo;
+-- This should send an error both places.
+\pset estream both
+select * from f oo;
+ERROR:  relation "f" does not exist
+LINE 1: select * from f oo;
+                      ^
+-- And this should return to the initial (default) setting,
+-- not send an error to the output file but do send it
+-- to stderr.
+\pset estream stderr
+select * from f oo;
+ERROR:  relation "f" does not exist
+LINE 1: select * from f oo;
+                      ^
+-- This should produce an error from psql.
+\pset estream bar
+\pset: allowed estream values are stderr, query, both
+-- This should display the current estream setting.
+-- (But does not in pg_regress.)
+\pset estream
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index 663bf8a..594d60d 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -88,7 +88,7 @@ test: privileges security_label collate
 # ----------
 # Another group of parallel tests
 # ----------
-test: misc alter_generic
+test: misc alter_generic estream
 
 # rules cannot run concurrently with any test that creates a view
 test: rules
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index be789e3..d8f2867 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -96,6 +96,7 @@ test: security_label
 test: collate
 test: misc
 test: alter_generic
+test: estream
 test: rules
 test: event_trigger
 test: select_views
diff --git a/src/test/regress/sql/estream.sql b/src/test/regress/sql/estream.sql
new file mode 100644
index 0000000..25f3b80
--- /dev/null
+++ b/src/test/regress/sql/estream.sql
@@ -0,0 +1,37 @@
+--
+-- Test of psql's \pset estream parameter.
+-- Don't use an actual table name since we might be running in parallel.
+--
+-- Bugs:
+--  o Uses /dev/null, which probably breaks on non-Unix boxes.
+--  o Due to the nature of the test framework, never looks at
+--    what's saved to the output file.  Instead tests what's
+--    missing from stdout/stderr.
+--
+
+\o /dev/null
+
+-- This should not send an error into the output file, but
+-- should send it to stderr.
+select * from f oo;
+
+-- This should send an error into the output file, but not stderr.
+\pset estream query
+select * from f oo;
+
+-- This should send an error both places.
+\pset estream both
+select * from f oo;
+
+-- And this should return to the initial (default) setting,
+-- not send an error to the output file but do send it
+-- to stderr.
+\pset estream stderr
+select * from f oo;
+
+-- This should produce an error from psql.
+\pset estream bar
+
+-- This should display the current estream setting.
+-- (But does not in pg_regress.)
+\pset estream

