Skip to content

Instantly share code, notes, and snippets.

@lucasdavila
Created September 13, 2012 20:54
Show Gist options
  • Select an option

  • Save lucasdavila/3717571 to your computer and use it in GitHub Desktop.

Select an option

Save lucasdavila/3717571 to your computer and use it in GitHub Desktop.
Simple script to run a PostgreSQL query in multitenancy dbs
sql="select 1"
for tenant_name in tenant_1 tenant_2 tenant_3 tenant_4
do
psql -d $tenant_name -c "$sql"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment