title: psql: warning: extra command-line argument "from" ignored
body: <p>I am trying to execute a non-interactive postgres command.</p>
  <pre><code>PGPASSWORD=$PGPASS psql -h 127.0.0.1 -U postgresql -d $PGDB --command &quot;select count(*) from services&quot;
  </code></pre>
  <p>Which has been giving me this response.</p>
  <blockquote>
  <p>psql: warning: extra command-line argument &quot;from&quot; ignored</p>
  <p>psql: warning: extra command-line argument &quot;services;&quot; ignored</p>
  <p>psql: warning: extra command-line argument &quot;mydbname&quot; ignored</p>
  <p>psql: FATAL:  database &quot;count(*)&quot; does not exist</p>
  </blockquote>
  <p>I've read that this could be because the terminal / bash is trying to break up each argument to <code>--command</code> / <code>-c</code> as it's own argument.</p>
  <p>I've also tried this:</p>
  <pre><code>PSQLARGS=(-h 127.0.0.1 -U postgresql -c )
  PSQLARGS+=(&quot;select count(*) from services;&quot;)
  PSQLARGS+=(${PGDB})
  PGPASSWORD=$PGPASS psql &quot;${PSQLARGS[@]}&quot;
  </code></pre>
  <p>Some way of forcing the terminal to know it's one argument, this also didn't work.</p>