Instructions:
Created view query is strangely different in the query.sql file that is generaed by pg_dump command. Original and simple one is shown in the blog
Download the query.sql file locally.
Find & replace pgsql username pgsql_user_name
with your actual one
Then import by command - $ psql -h localhost -d db -U pgsql_user_name -f query.sql