gooderp18绿色标准版
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

79 lines
7.5KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ALTER COLLATION</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="sql-alteraggregate.html" title="ALTER AGGREGATE" /><link rel="next" href="sql-alterconversion.html" title="ALTER CONVERSION" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">ALTER COLLATION</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-alteraggregate.html" title="ALTER AGGREGATE">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-alterconversion.html" title="ALTER CONVERSION">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="SQL-ALTERCOLLATION"><div class="titlepage"></div><a id="id-1.9.3.5.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">ALTER COLLATION</span></h2><p>ALTER COLLATION — change the definition of a collation</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
  3. ALTER COLLATION <em class="replaceable"><code>name</code></em> REFRESH VERSION
  4. ALTER COLLATION <em class="replaceable"><code>name</code></em> RENAME TO <em class="replaceable"><code>new_name</code></em>
  5. ALTER COLLATION <em class="replaceable"><code>name</code></em> OWNER TO { <em class="replaceable"><code>new_owner</code></em> | CURRENT_USER | SESSION_USER }
  6. ALTER COLLATION <em class="replaceable"><code>name</code></em> SET SCHEMA <em class="replaceable"><code>new_schema</code></em>
  7. </pre></div><div class="refsect1" id="id-1.9.3.5.5"><h2>Description</h2><p>
  8. <code class="command">ALTER COLLATION</code> changes the definition of a
  9. collation.
  10. </p><p>
  11. You must own the collation to use <code class="command">ALTER COLLATION</code>.
  12. To alter the owner, you must also be a direct or indirect member of the new
  13. owning role, and that role must have <code class="literal">CREATE</code> privilege on
  14. the collation's schema. (These restrictions enforce that altering the
  15. owner doesn't do anything you couldn't do by dropping and recreating the
  16. collation. However, a superuser can alter ownership of any collation
  17. anyway.)
  18. </p></div><div class="refsect1" id="id-1.9.3.5.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd><p>
  19. The name (optionally schema-qualified) of an existing collation.
  20. </p></dd><dt><span class="term"><em class="replaceable"><code>new_name</code></em></span></dt><dd><p>
  21. The new name of the collation.
  22. </p></dd><dt><span class="term"><em class="replaceable"><code>new_owner</code></em></span></dt><dd><p>
  23. The new owner of the collation.
  24. </p></dd><dt><span class="term"><em class="replaceable"><code>new_schema</code></em></span></dt><dd><p>
  25. The new schema for the collation.
  26. </p></dd><dt><span class="term"><code class="literal">REFRESH VERSION</code></span></dt><dd><p>
  27. Update the collation's version.
  28. See <a class="xref" href="sql-altercollation.html#SQL-ALTERCOLLATION-NOTES" title="Notes">Notes</a> below.
  29. </p></dd></dl></div></div><div class="refsect1" id="SQL-ALTERCOLLATION-NOTES"><h2>Notes</h2><p>
  30. When using collations provided by the ICU library, the ICU-specific version
  31. of the collator is recorded in the system catalog when the collation object
  32. is created. When the collation is used, the current version is
  33. checked against the recorded version, and a warning is issued when there is
  34. a mismatch, for example:
  35. </p><pre class="screen">
  36. WARNING: collation "xx-x-icu" has version mismatch
  37. DETAIL: The collation in the database was created using version 1.2.3.4, but the operating system provides version 2.3.4.5.
  38. 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.
  39. </pre><p>
  40. A change in collation definitions can lead to corrupt indexes and other
  41. problems because the database system relies on stored objects having a
  42. certain sort order. Generally, this should be avoided, but it can happen
  43. in legitimate circumstances, such as when
  44. using <code class="command">pg_upgrade</code> to upgrade to server binaries linked
  45. with a newer version of ICU. When this happens, all objects depending on
  46. the collation should be rebuilt, for example,
  47. using <code class="command">REINDEX</code>. When that is done, the collation version
  48. can be refreshed using the command <code class="literal">ALTER COLLATION ... REFRESH
  49. VERSION</code>. This will update the system catalog to record the
  50. current collator version and will make the warning go away. Note that this
  51. does not actually check whether all affected objects have been rebuilt
  52. correctly.
  53. </p><p>
  54. The following query can be used to identify all collations in the current
  55. database that need to be refreshed and the objects that depend on them:
  56. </p><pre class="programlisting">
  57. SELECT pg_describe_object(refclassid, refobjid, refobjsubid) AS "Collation",
  58. pg_describe_object(classid, objid, objsubid) AS "Object"
  59. FROM pg_depend d JOIN pg_collation c
  60. ON refclassid = 'pg_collation'::regclass AND refobjid = c.oid
  61. WHERE c.collversion &lt;&gt; pg_collation_actual_version(c.oid)
  62. ORDER BY 1, 2;
  63. </pre><p>
  64. </p></div><div class="refsect1" id="id-1.9.3.5.8"><h2>Examples</h2><p>
  65. To rename the collation <code class="literal">de_DE</code> to
  66. <code class="literal">german</code>:
  67. </p><pre class="programlisting">
  68. ALTER COLLATION "de_DE" RENAME TO german;
  69. </pre><p>
  70. </p><p>
  71. To change the owner of the collation <code class="literal">en_US</code> to
  72. <code class="literal">joe</code>:
  73. </p><pre class="programlisting">
  74. ALTER COLLATION "en_US" OWNER TO joe;
  75. </pre></div><div class="refsect1" id="id-1.9.3.5.9"><h2>Compatibility</h2><p>
  76. There is no <code class="command">ALTER COLLATION</code> statement in the SQL
  77. standard.
  78. </p></div><div class="refsect1" id="id-1.9.3.5.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-createcollation.html" title="CREATE COLLATION"><span class="refentrytitle">CREATE COLLATION</span></a>, <a class="xref" href="sql-dropcollation.html" title="DROP COLLATION"><span class="refentrytitle">DROP COLLATION</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-alteraggregate.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-alterconversion.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ALTER AGGREGATE </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ALTER CONVERSION</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1