title: Cast a column in CodeIgniter for PostgreSQL query
body: <p>I'm using CodeIgniter to build an application with PostgreSQL as the database layer.</p>
  
  <p>I have an AJAX based search function in the application that queries multiple columns in the database for potential matches. One particular column has a type of BIGINT. In order to do a LIKE query on this column, I first need to cast it to text. Writing the SQL for this is straightforward:</p>
  
  <pre><code> SELECT * FROM tablename WHERE columnname::text LIKE '1011%';
  </code></pre>
  
  <p>At the moment I cannot see a way of replicating this using CodeIgniter's Active Record as the following produces an error:</p>
  
  <pre><code>$this-&gt;db-&gt;like('columnname::text', '1011%');
  </code></pre>
  
  <p>Is it safe to assume that it's not possible to do this type of query in CI and should revert to <code>$this-&gt;db-&gt;query();</code>?</p>
  
  <p>The error I receive from CI is:</p>
  
  <pre><code>A Database Error Occurred
  Error Number:
  ERROR: column "columnname::text" does not exist LINE 3: WHERE "columnname::text" LIKE '%'
  </code></pre>
  
  <p>I haven't left the error number out above, that is how it appears.</p>