psql show me the : and ask user input, when running one sql file

Viewed 84
2 Answers

That colon : is not asking for user input. That's from the pager less. By default, when psql outputs something greater than a certain number of lines at a time, it will "paginate" it with less. You can see the same thing by running

cat /tmp/xbrlPublicPostgresDB.ddl | less

You can use arrow keys, page up, page down, j, k, and other keys to move around and see all the output. To exit, press q.

Paginating individual queries doesn't make much sense for what you're running, so you can disable pagination altogether when you run psql by setting the environment variable PAGER to a blank string:

PAGER= psql dbname -f xbrlPublicPostgresDB.ddl

I found the following parameter can stop that pagination, then I do not need to enter any key to continue. -P pager=off

Related