title: ERROR: operator does not exist: timestamp without time zone > integer)
body: <p>I am using Rails 5.2 and passing a date parameter. To simplify my example, look at the below sql query, it is similar but simplified as it is too complex to be used with active record methods, so I need to run the raw sql..</p>
  
  <pre><code>sql = 'Select * FROM mytable WHERE created_at &gt; #{@start_date_time}'
  </code></pre>
  
  <p>1) How do I sanitize the parameters as I pass them into a string or the execute command. </p>
  
  <p>2) What format should my date be in?  I tried '2018-01-01 00:00:00.000' and '2018-01-01' and both error.</p>
  
  <p>CODE:</p>
  
  <pre><code>sql =count_query(@start_date_time, sender_type, sender_id)
  records_array = ActiveRecord::Base.connection.execute(sql)
  </code></pre>
  
  <p>ERROR</p>
  
  <pre><code>ActiveRecord::StatementInvalid (PG::UndefinedFunction: 
  ERROR:  operator does not exist: timestamp without time zone &gt; integer)
  
  LINE 11: WHERE created_at &gt; 2018-01-01
  </code></pre>