While trying to generate test cases (run ./scripts/gen_psql_tests src/test/regress/sql /tmp/my_local_psql_tests/), the script fails at psql -U postgres -f /tmp/query.sql, since it tries to connect with psql. It is required as the script connects with database to check for any syntactical errors.