title: PostgreSQL: pass path from psql to create table name dynamically
body: <p>Suppose I have two paths, <code>/data/dev</code> and
  <code>/data/prod</code>. When developing, I want to use the <code>dev</code> directory, and in prod I want to use the <code>prod</code> directory.</p>
  
  <p>I need to upload data at some interval (<code>upload_to_tables.sql</code>):</p>
  
  <pre class="lang-sql prettyprint-override"><code>file := :basedir || 'file.csv';
  COPY my_table FROM :file WITH (FORMAT csv);
  </code></pre>
  
  <p>I tried running this, <code>$ environment=dev; psql -d my_database -v basedir="'/data/$environment'" -f upload_to_tables.sql</code></p>
  
  <p>I get this error:</p>
  
  <pre><code>2019-07-15 09:24:52.302 CDT [90820] ERROR:  syntax error at or near "file" at character 1
  </code></pre>
  
  <p>How can I path the directory from which these data need to be loaded in a dynamic fashion?</p>