psql -f and PAGER

Поиск
Список
Период
Сортировка
От Paul Jungwirth
Тема psql -f and PAGER
Дата
Msg-id db80016d-d0b6-a721-611b-21292a895af5@illuminatedcomputing.com
обсуждение исходный текст
Ответы Re: psql -f and PAGER  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
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@illuminatedcomputing.com



В списке pgsql-general по дате отправления:

Предыдущее
От: Philip Semanchuk
Дата:
Сообщение: Re: Why is my function inlined only when STABLE?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: psql -f and PAGER