title: How to change column type from oid to bytea in PostgreSQL
body: <p>At first place, I got this error: </p>
  
  <pre><code>org.postgresql.util.PSQLException: ERROR: column xxxx is of type oid but expression is of type bytea
  Hint: You will need to rewrite or cast the expression.
  Position: 318
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182)
  ...
  </code></pre>
  
  <p>After googled a while, I think I should change the column type from oid to bytea. I tried this in the UI pgAdmin:</p>
  
  <pre><code>ALTER TABLE theTableName
  ALTER COLUMN xxxx TYPE bytea
  </code></pre>
  
  <p>But I got error:</p>
  
  <pre><code>ERROR:  column "xxxx" cannot be cast automatically to type bytea
  HINT:  You might need to specify "USING xxxx::bytea".
  SQL state: 42804
  </code></pre>
  
  <p>Then I tried:</p>
  
  <pre><code>ALTER TABLE theTableName
  ALTER COLUMN xxxx TYPE bytea USING xxxx::bytea
  </code></pre>
  
  <p>And I got this error:</p>
  
  <pre><code>ERROR:  cannot cast type oid to bytea
  LINE 2: ALTER COLUMN xxxx TYPE bytea USING xxxx::bytea
                                                  ^
  SQL state: 42846
  Character: 88
  </code></pre>
  
  <ul>
  <li>System: Windows 10 </li>
  <li>PostgreSQL version :10</li>
  <li>pgAdmin 4 version: 3.0</li>
  <li>Python version 2.7.11</li>
  <li>Flask version: 0.12.2</li>
  </ul>
  
  <p>May I ask how to solve this? Thank you so much!</p>