I have already create bash script containing sql script (postgresql), but failed.
owner the file : postgres:postgres with 777 (chmod), but when I execute with "./bash1.sh" error: psql: FATAL: role "postgres" does not exist
the bash script:
#!/bin/sh
THE_DATABASE=epolicy
MY_TABLE=hpx_sms
psql ${THE_DATABASE} <<THE_END
SELECT * FROM ${MY_TABLE};
THE_END
how to fix this problem? or any reference? thank you.