You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows用户Heroku pg:psql执行SELECT命令报错:'more'未被识别

Fixing the "'more' is not recognized" Error in heroku pg:psql on Windows

Hey there! I’ve run into this exact issue before on Windows, so let’s get it sorted quickly. Here’s why it’s happening and how to fix it:

Why This Happens

When you run heroku pg:psql, the PostgreSQL client (psql) tries to use a pager to display long query results. By default, it might be pointing to the Unix-style more command, which doesn’t exist natively in Windows’ CMD or PowerShell—hence the error.

Quick Temporary Fix

If you just want to get past this right now, turn off the pager directly in your psql session:

  1. Once you’re connected to the Heroku database via heroku pg:psql, run this command:
    \pset pager off
    
  2. Now try your SELECT query again—it should output results without triggering the error.

Permanent Solutions

To avoid dealing with this every time you connect, pick one of these options:

Option 1: Disable Pager by Default for psql

  1. Create or edit the psql configuration file:
    • In Windows, this file lives at %APPDATA%\postgresql\psqlrc.conf (if it doesn’t exist, make a new text file with that exact name).
  2. Add this line to the file and save it:
    \pset pager off
    
  3. Next time you launch heroku pg:psql, the pager will be disabled automatically.

Option 2: Use Windows’ Native Pager

If you still want pagination, tell psql to use Windows’ built-in more.com instead of the Unix more:

  1. Open the same psqlrc.conf file mentioned above.
  2. Add this line instead:
    \set PAGER 'more.com'
    
  3. Save the file—now psql will use the Windows-compatible pager when displaying long results.

Option 3: Fix the PAGER Environment Variable

Sometimes your system’s PAGER environment variable is set to more, which confuses psql:

  1. Temporary fix (for current session):
    • In CMD: Run set PAGER=more.com
    • In PowerShell: Run $env:PAGER = 'more.com'
  2. Permanent fix:
    • Open System Properties → Advanced → Environment Variables
    • Under "User Variables", find or create a PAGER variable and set its value to more.com
    • Restart your terminal for the change to take effect

Final Check

After setting any of these up, launch heroku pg:psql again and run your SELECT query—you shouldn’t see that error anymore.

内容的提问来源于stack exchange,提问作者thox

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:30:09