{
    "mode": "man",
    "parameter": "ALTER_OPERATOR",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/ALTER_OPERATOR/7/json",
    "generated": "2026-10-07T14:13:06Z",
    "synopsis": "ALTER OPERATOR name ( { lefttype | NONE } , righttype )\nOWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER OPERATOR name ( { lefttype | NONE } , righttype )\nSET SCHEMA newschema\nALTER OPERATOR name ( { lefttype | NONE } , righttype )\nSET ( {  RESTRICT = { resproc | NONE }\n| JOIN = { joinproc | NONE }\n} [, ... ] )",
    "sections": {
        "NAME": {
            "content": "ALTEROPERATOR - change the definition of an operator\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ALTER OPERATOR name ( { lefttype | NONE } , righttype )\nOWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\n\nALTER OPERATOR name ( { lefttype | NONE } , righttype )\nSET SCHEMA newschema\n\nALTER OPERATOR name ( { lefttype | NONE } , righttype )\nSET ( {  RESTRICT = { resproc | NONE }\n| JOIN = { joinproc | NONE }\n} [, ... ] )\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "ALTER OPERATOR changes the definition of an operator.\n\nYou must own the operator to use ALTER OPERATOR. To alter the owner, you must be able to SET\nROLE to the new owning role, and that role must have CREATE privilege on the operator's\nschema. (These restrictions enforce that altering the owner doesn't do anything you couldn't\ndo by dropping and recreating the operator. However, a superuser can alter ownership of any\noperator anyway.)\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "name\nThe name (optionally schema-qualified) of an existing operator.\n\nlefttype\nThe data type of the operator's left operand; write NONE if the operator has no left\noperand.\n\nrighttype\nThe data type of the operator's right operand.\n\nnewowner\nThe new owner of the operator.\n\nnewschema\nThe new schema for the operator.\n\nresproc\nThe restriction selectivity estimator function for this operator; write NONE to remove\nexisting selectivity estimator.\n\njoinproc\nThe join selectivity estimator function for this operator; write NONE to remove existing\nselectivity estimator.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Change the owner of a custom operator a @@ b for type text:\n\nALTER OPERATOR @@ (text, text) OWNER TO joe;\n\nChange the restriction and join selectivity estimator functions of a custom operator a && b\nfor type int[]:\n\nALTER OPERATOR && (int4, int4) SET (RESTRICT = intcontsel, JOIN = intcontjoinsel);\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "There is no ALTER OPERATOR statement in the SQL standard.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "CREATE OPERATOR (CREATEOPERATOR(7)), DROP OPERATOR (DROPOPERATOR(7))\n\nPostgreSQL 16.14                                2026                               ALTER OPERATOR(7)",
            "subsections": []
        }
    },
    "summary": "ALTEROPERATOR - change the definition of an operator",
    "flags": [],
    "examples": [
        "Change the owner of a custom operator a @@ b for type text:",
        "ALTER OPERATOR @@ (text, text) OWNER TO joe;",
        "Change the restriction and join selectivity estimator functions of a custom operator a && b",
        "for type int[]:",
        "ALTER OPERATOR && (int4, int4) SET (RESTRICT = intcontsel, JOIN = intcontjoinsel);"
    ],
    "see_also": [
        {
            "name": "CREATEOPERATOR",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/CREATEOPERATOR/7/json"
        },
        {
            "name": "DROPOPERATOR",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/DROPOPERATOR/7/json"
        },
        {
            "name": "OPERATOR",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/OPERATOR/7/json"
        }
    ]
}