mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Remove pg_collation.collversion.
This model couldn't be extended to cover the default collation, and didn't have any information about the affected database objects when the version changed. Remove, in preparation for a follow-up commit that will add a new mechanism. Author: Thomas Munro <thomas.munro@gmail.com> Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com> Discussion: https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com
This commit is contained in:
@@ -2361,17 +2361,6 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||
<symbol>LC_CTYPE</symbol> for this collation object
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>collversion</structfield> <type>text</type>
|
||||
</para>
|
||||
<para>
|
||||
Provider-specific version of the collation. This is recorded when the
|
||||
collation is created and then checked when it is used, to detect
|
||||
changes in the collation definition that could lead to data corruption.
|
||||
</para></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
@@ -25444,11 +25444,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup());
|
||||
</para>
|
||||
<para>
|
||||
Returns the actual version of the collation object as it is currently
|
||||
installed in the operating system. If this is different from the
|
||||
value in
|
||||
<structname>pg_collation</structname>.<structfield>collversion</structfield>,
|
||||
then objects depending on the collation might need to be rebuilt. See
|
||||
also <xref linkend="sql-altercollation"/>.
|
||||
installed in the operating system.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
|
@@ -21,8 +21,6 @@ PostgreSQL documentation
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
ALTER COLLATION <replaceable>name</replaceable> REFRESH VERSION
|
||||
|
||||
ALTER COLLATION <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
|
||||
ALTER COLLATION <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
|
||||
ALTER COLLATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
|
||||
@@ -88,70 +86,9 @@ ALTER COLLATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_sche
|
||||
</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 using collations provided by the ICU library, the ICU-specific version
|
||||
of the collator is recorded in the system catalog when the collation object
|
||||
is created. 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
|
||||
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 collator 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> and
|
||||
<productname>PostgreSQL</productname> was built with the GNU C library, the
|
||||
C library's version is used as a collation version. Since collation
|
||||
definitions typically change only with GNU C library releases, this provides
|
||||
some defense against corruption, but it is not completely reliable.
|
||||
</para>
|
||||
<para>
|
||||
Currently, there is no version tracking for the database default collation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following query can be used to identify all collations in the current
|
||||
database that need to be refreshed and the objects that depend on them:
|
||||
<programlisting><![CDATA[
|
||||
SELECT pg_describe_object(refclassid, refobjid, refobjsubid) AS "Collation",
|
||||
pg_describe_object(classid, objid, objsubid) AS "Object"
|
||||
FROM pg_depend d JOIN pg_collation c
|
||||
ON refclassid = 'pg_collation'::regclass AND refobjid = c.oid
|
||||
WHERE c.collversion <> pg_collation_actual_version(c.oid)
|
||||
ORDER BY 1, 2;
|
||||
]]></programlisting></para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
||||
|
@@ -27,7 +27,6 @@ CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> (
|
||||
[ LC_CTYPE = <replaceable>lc_ctype</replaceable>, ]
|
||||
[ PROVIDER = <replaceable>provider</replaceable>, ]
|
||||
[ DETERMINISTIC = <replaceable>boolean</replaceable>, ]
|
||||
[ VERSION = <replaceable>version</replaceable> ]
|
||||
)
|
||||
CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> FROM <replaceable>existing_collation</replaceable>
|
||||
</synopsis>
|
||||
@@ -149,26 +148,6 @@ CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> FROM <replace
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable>version</replaceable></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies the version string to store with the collation. Normally,
|
||||
this should be omitted, which will cause the version to be computed
|
||||
from the actual version of the collation as provided by the operating
|
||||
system. This option is intended to be used
|
||||
by <command>pg_upgrade</command> for copying the version from an
|
||||
existing installation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also <xref linkend="sql-altercollation"/> for how to handle
|
||||
collation version mismatches.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable>existing_collation</replaceable></term>
|
||||
|
||||
|
Reference in New Issue
Block a user