title: Postgresql SQLSTATE[42P18]: Indeterminate datatype with PDO and CONCAT
body: <p>I'm having issues with <code>CONCAT()</code> when used on a <code>WHERE</code>, in <code>PDO</code>.</p>
  
  <p>The code:</p>
  
  <pre><code>&lt;?php
  require_once('config.php');
  
  $fdate = '01/01/2010';
  $tdate = '31/12/2030';
  $identification = '';
  
  $count = "SELECT count(*) as total FROM ( select time_id from doc_sent WHERE date &gt;= :fdate AND date &lt;= :tdate AND identification LIKE concat('%',:identification,'%') ) x;";
  
  //$count = "SELECT count(*) as total FROM ( select time_id from doc_sent WHERE date &gt;= :fdate AND date &lt;= :tdate ) x;";
  
  
  $stmt_count_row_main_table = $pdo-&gt;prepare($count);
  $stmt_count_row_main_table-&gt;execute(['fdate' =&gt; $fdate, 'tdate' =&gt; $tdate, 'identification' =&gt; $identification]);
  //$stmt_count_row_main_table-&gt;execute(['fdate' =&gt; $fdate, 'tdate' =&gt; $tdate]);
  $count_row_main_table = $stmt_count_row_main_table-&gt;fetch();
  
  print_r( $count_row_main_table);
  
  ?&gt;
  </code></pre>
  
  <p>The code works when the 'identification' part is commented.
  When I'm trying to use CONCAT(), it doesn't.</p>
  
  <p>I tried many "version" of CONCAT() (and read many other questions, like this one: <a href="https://stackoverflow.com/questions/583336/how-do-i-create-a-pdo-parameterized-query-with-a-like-statement">How do I create a PDO parameterized query with a LIKE statement?</a> ) but I am always referring to the main documentation:
  <a href="https://www.postgresql.org/docs/9.1/static/functions-string.html" rel="nofollow noreferrer">https://www.postgresql.org/docs/9.1/static/functions-string.html</a></p>
  
  <p>Which say:</p>
  
  <blockquote>
    <p>concat('abcde', 2, NULL, 22)  --> abcde222</p>
  </blockquote>
  
  <p>The FULL error when I use CONCAT() is:</p>
  
  <pre><code>PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P18]: Indeterminate datatype: 7 ERROR:  could not determine data type of parameter $3 in /var/www/pdo-reporter/show.php:17\nStack trace:\n#0 /var/www/pdo-reporter/show.php(17): PDOStatement-&gt;execute(Array)\n#1 {main}\n  thrown in /var/www/pdo-reporter/show.php on line 17
  </code></pre>
  
  <p>What's wrong with my code?</p>