{
    "mode": "man",
    "parameter": "SECURITY_LABEL",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/SECURITY_LABEL/7/json",
    "generated": "2026-10-04T08:30:44Z",
    "synopsis": "SECURITY LABEL [ FOR provider ] ON\n{\nTABLE objectname |\nCOLUMN tablename.columnname |\nAGGREGATE aggregatename ( aggregatesignature ) |\nDATABASE objectname |\nDOMAIN objectname |\nEVENT TRIGGER objectname |\nFOREIGN TABLE objectname |\nFUNCTION functionname [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nLARGE OBJECT largeobjectoid |\nMATERIALIZED VIEW objectname |\n[ PROCEDURAL ] LANGUAGE objectname |\nPROCEDURE procedurename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nPUBLICATION objectname |\nROLE objectname |\nROUTINE routinename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nSCHEMA objectname |\nSEQUENCE objectname |\nSUBSCRIPTION objectname |\nTABLESPACE objectname |\nTYPE objectname |\nVIEW objectname\n} IS { stringliteral | NULL }\nwhere aggregatesignature is:\n* |\n[ argmode ] [ argname ] argtype [ , ... ] |\n[ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]",
    "sections": {
        "NAME": {
            "content": "SECURITYLABEL - define or change a security label applied to an object\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "SECURITY LABEL [ FOR provider ] ON\n{\nTABLE objectname |\nCOLUMN tablename.columnname |\nAGGREGATE aggregatename ( aggregatesignature ) |\nDATABASE objectname |\nDOMAIN objectname |\nEVENT TRIGGER objectname |\nFOREIGN TABLE objectname |\nFUNCTION functionname [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nLARGE OBJECT largeobjectoid |\nMATERIALIZED VIEW objectname |\n[ PROCEDURAL ] LANGUAGE objectname |\nPROCEDURE procedurename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nPUBLICATION objectname |\nROLE objectname |\nROUTINE routinename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nSCHEMA objectname |\nSEQUENCE objectname |\nSUBSCRIPTION objectname |\nTABLESPACE objectname |\nTYPE objectname |\nVIEW objectname\n} IS { stringliteral | NULL }\n\nwhere aggregatesignature is:\n\n* |\n[ argmode ] [ argname ] argtype [ , ... ] |\n[ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "SECURITY LABEL applies a security label to a database object. An arbitrary number of security\nlabels, one per label provider, can be associated with a given database object. Label\nproviders are loadable modules which register themselves by using the function\nregisterlabelprovider.\n\nNote\n\nregisterlabelprovider is not an SQL function; it can only be called from C code loaded\ninto the backend.\n\nThe label provider determines whether a given label is valid and whether it is permissible to\nassign that label to a given object. The meaning of a given label is likewise at the\ndiscretion of the label provider.  PostgreSQL places no restrictions on whether or how a\nlabel provider must interpret security labels; it merely provides a mechanism for storing\nthem. In practice, this facility is intended to allow integration with label-based mandatory\naccess control (MAC) systems such as SELinux. Such systems make all access control decisions\nbased on object labels, rather than traditional discretionary access control (DAC) concepts\nsuch as users and groups.\n\nYou must own the database object to use SECURITY LABEL.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "objectname\ntablename.columnname\naggregatename\nfunctionname\nprocedurename\nroutinename\nThe name of the object to be labeled. Names of objects that reside in schemas (tables,\nfunctions, etc.) can be schema-qualified.\n\nprovider\nThe name of the provider with which this label is to be associated. The named provider\nmust be loaded and must consent to the proposed labeling operation. If exactly one\nprovider is loaded, the provider name may be omitted for brevity.\n\nargmode\nThe mode of a function, procedure, or aggregate argument: IN, OUT, INOUT, or VARIADIC. If\nomitted, the default is IN. Note that SECURITY LABEL does not actually pay any attention\nto OUT arguments, since only the input arguments are needed to determine the function's\nidentity. So it is sufficient to list the IN, INOUT, and VARIADIC arguments.\n\nargname\nThe name of a function, procedure, or aggregate argument. Note that SECURITY LABEL does\nnot actually pay any attention to argument names, since only the argument data types are\nneeded to determine the function's identity.\n\nargtype\nThe data type of a function, procedure, or aggregate argument.\n\nlargeobjectoid\nThe OID of the large object.\n\nPROCEDURAL\nThis is a noise word.\n\nstringliteral\nThe new setting of the security label, written as a string literal.\n\nNULL\nWrite NULL to drop the security label.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "The following example shows how the security label of a table could be set or changed:\n\nSECURITY LABEL FOR selinux ON TABLE mytable IS 'systemu:objectr:sepgsqltablet:s0';\n\nTo remove the label:\n\nSECURITY LABEL FOR selinux ON TABLE mytable IS NULL;\n\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "There is no SECURITY LABEL command in the SQL standard.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "sepgsql, src/test/modules/dummyseclabel\n\nPostgreSQL 16.14                                2026                               SECURITY LABEL(7)",
            "subsections": []
        }
    },
    "summary": "SECURITYLABEL - define or change a security label applied to an object",
    "flags": [],
    "examples": [
        "The following example shows how the security label of a table could be set or changed:",
        "SECURITY LABEL FOR selinux ON TABLE mytable IS 'systemu:objectr:sepgsqltablet:s0';",
        "To remove the label:",
        "SECURITY LABEL FOR selinux ON TABLE mytable IS NULL;"
    ],
    "see_also": [
        {
            "name": "LABEL",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/LABEL/7/json"
        }
    ]
}