title: Postgresql and BLOBs - maximum size of bytea?
body: <p>I'm currently trying to store images in a psql table and was following this guide <a href="http://jdbc.postgresql.org/documentation/80/binary-data.html" rel="noreferrer">here</a> using a bytea for the image. Problem is that the image I'm trying to insert is ~24kb and I keep getting an error that the maximum size is 8191, though I've read in other places that a bytea should be able to store up to 1gb. Surely I should be able to raise this max limit somehow?</p>
  
  <p>Code:</p>
  
  <pre><code>String query = "INSERT INTO " + tableName + " VALUES(?);";
  try {
      PreparedStatement stmt = conn.prepareStatement(query);
      File file = new File(location);
      FileInputStream fi = new FileInputStream(file);
      stmt.setBinaryStream(1, fi, (int)file.length());
      boolean res = stmt.execute();
      stmt.close();
      fi.close
      return res;
  }
  </code></pre>
  
  <p>The database table only consists of a bytea at the moment.</p>
  
  <p>Error message:</p>
  
  <pre><code>org.postgresql.util.PSQLException: ERROR: index row requires 23888 bytes, maximum size is 8191
  </code></pre>