title: storing an arbitrary date in a variable in Postgres
body: <p>[This is probably really easy, but I've googled unsuccessfully for far too long]</p>
  
  <p>I want to store a series of dates in variables in Postgres in order to run a series of queries against them:</p>
  
  <pre><code>\set SESSION startDate  date'2018-04-01'
  \set SESSION reportDate  CURRENT_DATE
  </code></pre>
  
  <p>I then want to run a series of queries like</p>
  
  <pre><code>SELECT COUNT(id) FROM assets
  WHERE target_date &gt; :startDate
  AND target_date &lt; :reportDate;
  </code></pre>
  
  <p>My variable "reportDate" works fine, but can someone please tell me how to correctly set an arbitrary date as "startDate".  I've tried all manners of escaping the value for the \set command unsuccessfully.</p>
  
  <p>The error I get is:</p>
  
  <pre><code>ERROR:  column "date2018" does not exist
  </code></pre>
  
  <p>I'm using PostgreSQL 9.3.22.</p>
  
  <p>Many Thanks</p>