Re: psql -f and PAGER
От | Peter J. Holzer |
---|---|
Тема | Re: psql -f and PAGER |
Дата | |
Msg-id | 20220330065752.rykgxuzjdzbms5gw@hjp.at обсуждение исходный текст |
Ответ на | Re: psql -f and PAGER ("David G. Johnston" <david.g.johnston@gmail.com>) |
Список | pgsql-general |
On 2022-03-29 19:08:44 -0700, David G. Johnston wrote: > On Tue, Mar 29, 2022 at 6:30 PM Paul Jungwirth <pj@illuminatedcomputing.com> > wrote: > > I noticed that this runs your pager: > > psql -f <(echo 'select * from pg_class;') > > but not this: > > echo 'select * from pg_class;' | psql [...] > > For both examples: > pager defaults to on > the output of the psql session is a terminal > the full contents of pg_class are not going to fit on one terminal screen > ergo, the output of select * from pg_class; should be piped to the pager in > both cases This is incomplete in the docs. The pager is also not called if stdin is not a terminal (which makes sense - you couldn't control the pager). So echo 'select * from pg_class;' | psql doesn't call the pager. Neither do: psql -f <(echo 'select * from pg_class;') < /dev/null psql -f <(echo 'select * from pg_class;') > /dev/null But psql -f <(echo 'select * from pg_class;') does, since both stdin and stdout are a terminal. hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
Вложения
В списке pgsql-general по дате отправления: