Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/alter_collation.sgml`
315215e4da1212221c57d85a5f9c2957d3380bd2224d22ae00000001000008b1
 </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>REFRESH VERSION</literal></term>
    <listitem>
     <para>
      Update the collation's version.
      See <xref linkend="sql-altercollation-notes"/> below.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 id="sql-altercollation-notes" xreflabel="Notes">
  <title>Notes</title>

  <para>
   When a collation object is created, the provider-specific version of the
   collation is recorded in the system catalog.  When the collation is used,
   the current version is
   checked against the recorded version, and a warning is issued when there is
   a mismatch, for example:
<screen>
WARNING:  collation "xx-x-icu" has version mismatch
DETAIL:  The collation in the database was created using version 1.2.3.4, but the operating system provides version 2.3.4.5.
HINT:  Rebuild all objects affected by this collation and run ALTER COLLATION pg_catalog."xx-x-icu" REFRESH VERSION, or build PostgreSQL with the right library version.
</screen>
   A change in collation definitions can lead to corrupt indexes and other
   problems because the database system relies on stored objects having a
   certain sort order.  Generally, this should be avoided, but it can happen
   in legitimate circumstances, such as when upgrading the operating system
   to a new major version or when
   using <command>pg_upgrade</command> to upgrade to server binaries linked
   with a newer version of ICU.  When this happens, all objects depending on
   the collation should be rebuilt, for example,
   using <command>REINDEX</command>.  When that is done, the collation version
   can be refreshed using the command <literal>ALTER COLLATION ... REFRESH
   VERSION</literal>.  This will update the system catalog to record the
   current collation version and will make the warning go away.  Note that this
   does not actually check whether all affected objects have been rebuilt
   correctly.
  </para>
  <para>
   When using collations provided by <literal>libc</literal>, version
   information is recorded on systems using the GNU C library (most Linux
   systems), FreeBSD and Windows.  When using collations provided

Title: ALTER COLLATION Notes on Version Mismatches
Summary
When a collation is created, its provider-specific version is stored in the system catalog. A warning is issued if the current version doesn't match the recorded version. Mismatched collation definitions can cause corrupted indexes. To resolve this, rebuild objects dependent on the collation using REINDEX. Afterward, use `ALTER COLLATION ... REFRESH VERSION` to update the system catalog and remove the warning. Version information is recorded for `libc` collations on GNU C library (Linux), FreeBSD, and Windows.