I have a bash script that contains this:
PGPASSWORD=root psql -h localhost -d $db_name -U root
#Need to execute manually
SELECT set_config('SESSION_CONTEXT.APP_USER', 'root', false);
\i data.dump
\q
echo 'Done!'
the first line will start a Postgres session which won't let bash execute the commands below and I have to do it manually. How can I get around this in a way that this will be automatically executed?