{
    "content": [
        {
            "type": "text",
            "text": "# ALTER_COLLATION (man)\n\n## NAME\n\nALTERCOLLATION - change the definition of a collation\n\n## SYNOPSIS\n\nALTER COLLATION name REFRESH VERSION\nALTER COLLATION name RENAME TO newname\nALTER COLLATION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER COLLATION name SET SCHEMA newschema\n\n## DESCRIPTION\n\nALTER COLLATION changes the definition of a collation.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PARAMETERS**\n- **NOTES**\n- **EXAMPLES**\n- **COMPATIBILITY**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ALTER_COLLATION",
        "section": "",
        "mode": "man",
        "summary": "ALTERCOLLATION - change the definition of a collation",
        "synopsis": "ALTER COLLATION name REFRESH VERSION\nALTER COLLATION name RENAME TO newname\nALTER COLLATION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER COLLATION name SET SCHEMA newschema",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "To rename the collation deDE to german:",
            "ALTER COLLATION \"deDE\" RENAME TO german;",
            "To change the owner of the collation enUS to joe:",
            "ALTER COLLATION \"enUS\" OWNER TO joe;"
        ],
        "see_also": [
            {
                "name": "CREATECOLLATION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/CREATECOLLATION/7/json"
            },
            {
                "name": "DROPCOLLATION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/DROPCOLLATION/7/json"
            },
            {
                "name": "COLLATION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/COLLATION/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 43,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "COMPATIBILITY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "ALTERCOLLATION - change the definition of a collation\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "ALTER COLLATION name REFRESH VERSION\n\nALTER COLLATION name RENAME TO newname\nALTER COLLATION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER COLLATION name SET SCHEMA newschema\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "ALTER COLLATION changes the definition of a collation.\n\nYou must own the collation to use ALTER COLLATION. To alter the owner, you must also be a\ndirect or indirect member of the new owning role, and that role must have CREATE privilege on\nthe collation's schema. (These restrictions enforce that altering the owner doesn't do\nanything you couldn't do by dropping and recreating the collation. However, a superuser can\nalter ownership of any collation anyway.)\n",
                "subsections": []
            },
            "PARAMETERS": {
                "content": "name\nThe name (optionally schema-qualified) of an existing collation.\n\nnewname\nThe new name of the collation.\n\nnewowner\nThe new owner of the collation.\n\nnewschema\nThe new schema for the collation.\n\nREFRESH VERSION\nUpdate the collation's version. See Notes below.\n",
                "subsections": []
            },
            "NOTES": {
                "content": "When using collations provided by the ICU library, the ICU-specific version of the collator\nis recorded in the system catalog when the collation object is created. When the collation is\nused, the current version is checked against the recorded version, and a warning is issued\nwhen there is a mismatch, for example:\n\nWARNING:  collation \"xx-x-icu\" has version mismatch\nDETAIL:  The collation in the database was created using version 1.2.3.4, but the operating system provides version 2.3.4.5.\nHINT:  Rebuild all objects affected by this collation and run ALTER COLLATION pgcatalog.\"xx-x-icu\" REFRESH VERSION, or build PostgreSQL with the right library version.\n\nA change in collation definitions can lead to corrupt indexes and other problems because the\ndatabase system relies on stored objects having a certain sort order. Generally, this should\nbe avoided, but it can happen in legitimate circumstances, such as when using pgupgrade to\nupgrade to server binaries linked with a newer version of ICU. When this happens, all objects\ndepending on the collation should be rebuilt, for example, using REINDEX. When that is done,\nthe collation version can be refreshed using the command ALTER COLLATION ... REFRESH VERSION.\nThis will update the system catalog to record the current collator version and will make the\nwarning go away. Note that this does not actually check whether all affected objects have\nbeen rebuilt correctly.\n\nWhen using collations provided by libc, version information is recorded on systems using the\nGNU C library (most Linux systems), FreeBSD and Windows.\n\nNote\nWhen using the GNU C library for collations, the C library's version is used as a proxy\nfor the collation version. Many Linux distributions change collation definitions only\nwhen upgrading the C library, but this approach is imperfect as maintainers are free to\nback-port newer collation definitions to older C library releases.\n\nWhen using Windows for collations, version information is only available for collations\ndefined with BCP 47 language tags such as en-US.\n\nCurrently, there is no version tracking for the database default collation.\n\nThe following query can be used to identify all collations in the current database that need\nto be refreshed and the objects that depend on them:\n\nSELECT pgdescribeobject(refclassid, refobjid, refobjsubid) AS \"Collation\",\npgdescribeobject(classid, objid, objsubid) AS \"Object\"\nFROM pgdepend d JOIN pgcollation c\nON refclassid = 'pgcollation'::regclass AND refobjid = c.oid\nWHERE c.collversion <> pgcollationactualversion(c.oid)\nORDER BY 1, 2;\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "To rename the collation deDE to german:\n\nALTER COLLATION \"deDE\" RENAME TO german;\n\nTo change the owner of the collation enUS to joe:\n\nALTER COLLATION \"enUS\" OWNER TO joe;\n",
                "subsections": []
            },
            "COMPATIBILITY": {
                "content": "There is no ALTER COLLATION statement in the SQL standard.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "CREATE COLLATION (CREATECOLLATION(7)), DROP COLLATION (DROPCOLLATION(7))\n\n\n\nPostgreSQL 14.23                                2026                              ALTER COLLATION(7)",
                "subsections": []
            }
        }
    }
}