title: How to solve PostgreSQL index width problem
body: <p>I have a docker container which contains a PostgreSQL database. An application then connects to the database. In the database I have a table defined as:</p>
  <pre><code>CREATE TABLE IF NOT EXISTS configuration (
      id SERIAL PRIMARY KEY,
      board BIGINT NOT NULL REFERENCES boards ( id ),
      date_time decimal(20,0) NOT NULL,
      version INTEGER NOT NULL,
      data TEXT NOT NULL,
      UNIQUE(board, date_time, version, data)
  );
  </code></pre>
  <p>I am not explicitly creating any indices or any of the other meta-objects associated with this table.</p>
  <p>The application used to be able to write to this table without problem, but now I am getting the following error:</p>
  <pre><code>Failure during 'insert_configuration_record': ERROR:  index row size 5992 exceeds btree version 4 maximum 2704 for index &quot;configuration_board_date_time_version_data_key&quot;
  DETAIL:  Index row references tuple (2,12) in relation &quot;configuration&quot;.
  HINT:  Values larger than 1/3 of a buffer page cannot be indexed.
  Consider a function index of an MD5 hash of the value, or use full text indexing.
  </code></pre>
  <p>It is possible that the PostgreSQL version changed at some point when I rebuilt the docker container, but I have not seen any messages refusing to load the database from the persistent storage or asking me to upgrade it. The current database version is <code>(PostgreSQL) 12.9 (Ubuntu 12.9-0ubuntu0.20.04.1)</code>.</p>
  <p>It is possible that previously the data I was writing was short enough to not hit the limit.</p>
  <p>How do I use &quot;a function index of an MD5 hash of the value&quot; to avoid this problem?</p>