Search Postgresql Archives

psql -f and PAGER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I noticed that this runs your pager:

    psql -f <(echo 'select * from pg_class;')

but not this:

    echo 'select * from pg_class;' | psql

A client encountered this when the psql command run from their deb's .postinst file started to hang.

We can prevent it with PSQL_PAGER='', but it almost seems like a bug to me, since I expect -f to be for non-interactive use. I'd at least call it a footgun.

Indeed running the pager for -f but not stdin seems opposite of the last line of these docs (https://www.postgresql.org/docs/14/app-psql.html):

> Using this option is subtly different from writing psql < filename. In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand.

Does it seem wrong to anyone else to run the pager from -f? Is it something the community would accept patches to change?

Yours,

--
Paul              ~{:-)
pj@xxxxxxxxxxxxxxxxxxxxxxxx





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux