Hi i have a psql statement which needs to be run from a shell script.
i have tried below but no success
ctfdb is my database
psql ctfdb <<EOF
psql: FATAL: Peer authentication failed for user "root"
Sorry, user root is not allowed to execute '/bin/psql ctfdb' as root on my server
psql -U postgres ctfdb
Connects as user
postgres. You are connecting to the DB as your shell username
There are other ways such as setting the
PGUSER environment variable or configuring
pg_hba.conf to allow access for other users.