title: How to get Substring in sql query
body: <p>I am trying to get substring from 0-7 position in an int element in table name so when I insert this</p>
  
  <pre><code>select substring(column_name,0, 6) as new_name from table_name 
  </code></pre>
  
  <p>I am getting </p>
  
  <blockquote>
    <p>SQL Error [42883]: ERROR: function pg_catalog.substring(bigint,
    integer, integer) does not exist</p>
    
    <p>Hint: No function matches the given name and argument types. You
    might need to add explicit type casts.</p>
    
    <p>Position: 8</p>
    
    <p>org.postgresql.util.PSQLException: ERROR: function
    pg_catalog.substring(bigint, integer, integer) does not exist</p>
    
    <p>Hint: No function matches the given name and argument types. You
    might need to add explicit type casts.   Position: 8</p>
  </blockquote>
  
  <p>so after adding some cast to varchar(8)</p>
  
  <pre><code>select substring(varchar(8),column_name,0, 6) as new_name from table_name
  </code></pre>
  
  <p>getting this</p>
  
  <blockquote>
    <p>SQL Error [42601]: ERROR: syntax error at or near ","   Position: 28<br>
    org.postgresql.util.PSQLException: ERROR: syntax error at or near "," 
    Position: 28</p>
  </blockquote>
  
  <p>I cant figure out what am I doing wrong. Thanks.</p>