title: How to update bytea data in Postgres table?
body: <p>I am trying to import contents of a file locally stored into a column of a row in a table.
  The type of column is bytea.</p>
  
  <p>Something like:</p>
  
  <pre><code>UPDATE server_info
  SET key = lo_import('C:\Users\certificate.p12')
  WHERE server_id = 1;
  </code></pre>
  
  <p>However, it gives below error:</p>
  
  <pre><code>ERROR:  column "key" is of type bytea but expression is of type oid
  </code></pre>
  
  <p>I tried casting. Used below line for it:</p>
  
  <pre><code>UPDATE server_info
  SET key = lo_import('C:\Users\certificate.p12')::bytea
  WHERE server_id = 1;
  </code></pre>
  
  <p>But it gives:</p>
  
  <pre><code>ERROR:  cannot cast type oid to bytea
  </code></pre>
  
  <p>I am new to using Postgres. Any leads in this matter will be helpful. Thank you</p>