(postgresql) 데이터베이스를 쿼리할 때 zsh가 덜 작동하는 이유는 무엇입니까?

(postgresql) 데이터베이스를 쿼리할 때 zsh가 덜 작동하는 이유는 무엇입니까?

문맥

  • zsh껍데기,
  • oh-my-zsh뼈대,
  • zsh에 대한 특별한 구성은 없습니다 postgresql.

문제

데이터베이스를 쿼리할 때 다음과 같은 짜증나는 동작을 발견했습니다.

SELECT * FROM mytable ;

less(with ) 처럼 작동 (END)하고 뒤로 돌아가려면 less( q바로가기 사용)을 "닫아야" 합니다. 즉, 다음 쿼리를 입력할 때 이전 쿼리 결과를 읽을 수 없습니다.

반대로, bash이 동작은 아닌가요: 쿼리 후에 결과가 표시되고 다음 쿼리를 입력하는 것이 가능합니다.

질문

zsh이 점에서 작동하도록 어떻게 사용자 정의할 수 있습니까 bash?

답변1

댓글을 달아서 완전히 차단할 수도 있습니다.

cat ~/.oh-my-zsh/lib/misc.zsh
...
#env_default 'PAGER' 'less'                                                        
#env_default 'LESS' '-R'                                                           
...

그런 다음 새 터미널을 열고 다시 시도하십시오. 또는..

exec zsh (in the same terminal)

답변2

쉘이 환경 변수를 설정하고 있을 가능성이 있습니다 PAGER.

psql을 실행하기 전에 설정을 해제해 보십시오.

user@host% unset PAGER

postgresql 셸에서 다음과 같이 호출기 pset 값을 "off"로 설정해 볼 수도 있습니다.

user=> \pset pager off

그러면 호출기 사용을 켜거나 끌 수 있습니다. 특정 호출기(예 more: less, , 등) 를 사용하도록 설정할 수도 있습니다 cat.

psql 매뉴얼 페이지의 추가 정보:

pager

    Controls use of a pager for query and psql help output. If the
environment variable PAGER is set, the output is piped to the
specified program. Otherwise a platform-dependent default (such as
more) is used.

    When the pager is off, the pager is not used. When the pager is on,
the pager is used only when appropriate, i.e. the output is to a
terminal and will not fit on the screen. (psql does not do a perfect
job of estimating when to use the pager.) \pset pager turns the pager
on and off. Pager can also be set to always, which causes the pager to
be always used.

관련 정보