title: The RIGHT() function in PostgreSQL gives an error
body: <p>I'm trying to use the <code>RIGHT()</code> function it so it will only display the last 4 digits of a credit card number pulled from the customer table. This is what I have so far:</p>
  
  <pre><code>create function get_customer(text) returns setof cusinfo as
  
  $$
  
  select upper(first_name)||' '||upper(last_name) as full_name, upper(address), upper(city)||', '||upper(state)||' '||zip as citystatezip, email, '************'||right(cc_number,4), cc_name
  
  from customer
  
  where customer_id = $1;
  
  $$ language sql;
  </code></pre>
  
  <p>The error I am being given is:</p>
  
  <blockquote>
    <p>psql:finalproject.sql:273: ERROR:  function right(text, integer) does not exist
        LINE 3: ...|' '||zip as citystatezip, email, '<strong><em>*</em>**<em>*</em></strong>'||right(cc_n...</p>
  </blockquote>
  
  <p>Any ideas as to why this is happening? I tried only using <code>RIGHT()</code> by itself and putting in something like <code>RIGHT('Help me', 2)</code>, but I get the same error.</p>