Running queries one after the other in psql/scripting environment?
As @a_horse_with_no_name said, if you want to restrict the order on db level, use sequential statements, either with psql -f queries.sql or :

psql &lt;&lt;EOF 
select..;
select..;
EOF


In your example you call psql for each query. You don't send them to background so each psql waits previous to end before calling next. Concurrency should be sane here as well. Things that you have different here: lack of control over transaction, you open/close many connections instead of one and you put sql code into bash variable