title: Relation does not exist when trying to grant privileges
body: <p>I'm currently writing a script to build my vagrant box. I got PHP 7 and some other tools installed, as well as PostgreSQL, but when creating the database and trying to grant privileges I'm getting the following error</p>
  
  <p><code>ERROR:  relation "projectname" does not exist</code></p>
  
  <p>This is my script (the important stuff)</p>
  
  <pre><code>#!/usr/bin/env bash
  projectname='projectname'
  echo "Initializing database"
  sudo apt-get install -y postgresql
  sudo -u postgres psql -c "CREATE USER $projectname WITH PASSWORD 'xxxx';"
  sudo -u postgres psql -c "CREATE DATABASE $projectname;"
  sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON $projectname TO $projectname;"
  </code></pre>
  
  <p>Everything works until the last step</p>
  
  <p><code>sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON $projectname TO $projectname;"</code></p>
  
  <p>When trying this out, I'm getting the above error. I also tried to write it manually</p>
  
  <p><code>sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON projectname TO projectname;"</code> </p>
  
  <p>Same error.</p>
  
  <p>I also tried to wrap it in quotation marks</p>
  
  <pre><code>sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON 'feedparser' TO 'feedparser';"
  
  sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON \"feedparser\" TO \"feedparser\";"
  </code></pre>
  
  <p>What exactly am I doing wrong here?</p>