{"kind": "relopts", "major": "18", "item": {"slug": "view-security-invoker", "name": "security_invoker", "name_zh": "security_invoker", "category": "View options", "summary": "This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. See the notes below for full details.", "aliases": ["view.security_invoker"], "versions": {"15": {"facts": [{"label": "Applies to", "value": "View options"}, {"label": "Value type", "value": "boolean"}], "related": [{"url": "/docs/sql/create-view/?v=15", "label": "CREATE VIEW"}], "release": {"ref": "Local English manual 15.19", "label": "15.19", "major": "15", "channel": "stable", "revision": "643ecd492fa284d4d55861f15cbd7c0c7451abce96c8d56485bb2729caba37d5"}, "sources": [{"url": "/docs/15/sql-createview.html", "path": "sql-createview.html", "label": "PostgreSQL 15 English manual", "sha256": "5e264be14c16e87295e86ed356aea640f7a46a5a5fe713dc20c903e8301d690c"}], "sections": [{"title": "View options", "paragraphs": ["Views do not store query results. Set these security or update semantics with CREATE VIEW WITH or ALTER VIEW."]}, {"title": "Security semantics", "paragraphs": ["If the view has the security_invoker property set to true , access to the underlying base relations is determined by the permissions of the user executing the query, rather than the view owner. Thus, the user of a security invoker view must have the relevant permissions on the view and its underlying base relations.", "If any of the underlying base relations is a security invoker view, it will be treated as if it had been accessed directly from the original query. Thus, a security invoker view will always check its underlying base relations using the permissions of the current user, even if it is accessed from a view without the security_invoker property.", "If any of the underlying base relations has row-level security enabled, then by default, the row-level security policies of the view owner are applied, and access to any additional relations referred to by those policies is determined by the permissions of the view owner. However, if the view has security_invoker set to true , then the policies and permissions of the invoking user are used instead, as if the base relations had been referenced directly from the query using the view.", "Functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore, the user of a view must have permissions to call all functions used by the view. Functions in the view are executed with the privileges of the user executing the query or the function owner, depending on whether the functions are defined as SECURITY INVOKER or SECURITY DEFINER . Thus, for example, calling CURRENT_USER directly in a view will always return the invoking user, not the view owner. This is not affected by the view's security_invoker setting, and so a view with security_invoker set to false is not equivalent to a SECURITY DEFINER function and those concepts should not be confused.", "Note that the user performing the insert, update or delete on the view must have the corresponding insert, update or delete privilege on the view. In addition, by default, the view's owner must have the relevant privileges on the underlying base relations, whereas the user performing the update does not need any permissions on the underlying base relations (see Section 41.5 ). However, if the view has security_invoker set to true , the user performing the update, rather than the view owner, must have the relevant privileges on the underlying base relations."]}], "signature": "WITH (security_invoker = value)", "description": ["This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. See the notes below for full details."]}, "16": {"facts": [{"label": "Applies to", "value": "View options"}, {"label": "Value type", "value": "boolean"}], "related": [{"url": "/docs/sql/create-view/?v=16", "label": "CREATE VIEW"}], "release": {"ref": "Local English manual 16.15", "label": "16.15", "major": "16", "channel": "stable", "revision": "0080d7d37081f27216dc4aa4f6ad85ea24c0c0441e702e6d0b190a339fd76f62"}, "sources": [{"url": "/docs/16/sql-createview.html", "path": "sql-createview.html", "label": "PostgreSQL 16 English manual", "sha256": "4b881ea4898cc76b99becc82db07c4f45d51eb92566127d308b676625b4d06fd"}], "sections": [{"title": "View options", "paragraphs": ["Views do not store query results. Set these security or update semantics with CREATE VIEW WITH or ALTER VIEW."]}, {"title": "Security semantics", "paragraphs": ["If the view has the security_invoker property set to true , access to the underlying base relations is determined by the permissions of the user executing the query, rather than the view owner. Thus, the user of a security invoker view must have the relevant permissions on the view and its underlying base relations.", "If any of the underlying base relations is a security invoker view, it will be treated as if it had been accessed directly from the original query. Thus, a security invoker view will always check its underlying base relations using the permissions of the current user, even if it is accessed from a view without the security_invoker property.", "If any of the underlying base relations has row-level security enabled, then by default, the row-level security policies of the view owner are applied, and access to any additional relations referred to by those policies is determined by the permissions of the view owner. However, if the view has security_invoker set to true , then the policies and permissions of the invoking user are used instead, as if the base relations had been referenced directly from the query using the view.", "Functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore, the user of a view must have permissions to call all functions used by the view. Functions in the view are executed with the privileges of the user executing the query or the function owner, depending on whether the functions are defined as SECURITY INVOKER or SECURITY DEFINER . Thus, for example, calling CURRENT_USER directly in a view will always return the invoking user, not the view owner. This is not affected by the view's security_invoker setting, and so a view with security_invoker set to false is not equivalent to a SECURITY DEFINER function and those concepts should not be confused.", "Note that the user performing the insert, update or delete on the view must have the corresponding insert, update or delete privilege on the view. In addition, by default, the view's owner must have the relevant privileges on the underlying base relations, whereas the user performing the update does not need any permissions on the underlying base relations (see Section 41.5 ). However, if the view has security_invoker set to true , the user performing the update, rather than the view owner, must have the relevant privileges on the underlying base relations."]}], "signature": "WITH (security_invoker = value)", "description": ["This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. See the notes below for full details."]}, "17": {"facts": [{"label": "Applies to", "value": "View options"}, {"label": "Value type", "value": "boolean"}], "related": [{"url": "/docs/sql/create-view/?v=17", "label": "CREATE VIEW"}], "release": {"ref": "Local English manual 17.11", "label": "17.11", "major": "17", "channel": "stable", "revision": "440f894c3464e7cb4fedc9846b948ca21cd2ffcef1697ff56a28eb641ee7c3d8"}, "sources": [{"url": "/docs/17/sql-createview.html", "path": "sql-createview.html", "label": "PostgreSQL 17 English manual", "sha256": "80b0ff1f7c82a347bb322670817b6cc38c71b249f6b49163dcdd80f3bbd184a4"}], "sections": [{"title": "View options", "paragraphs": ["Views do not store query results. Set these security or update semantics with CREATE VIEW WITH or ALTER VIEW."]}, {"title": "Security semantics", "paragraphs": ["If the view has the security_invoker property set to true , access to the underlying base relations is determined by the permissions of the user executing the query, rather than the view owner. Thus, the user of a security invoker view must have the relevant permissions on the view and its underlying base relations.", "If any of the underlying base relations is a security invoker view, it will be treated as if it had been accessed directly from the original query. Thus, a security invoker view will always check its underlying base relations using the permissions of the current user, even if it is accessed from a view without the security_invoker property.", "If any of the underlying base relations has row-level security enabled, then by default, the row-level security policies of the view owner are applied, and access to any additional relations referred to by those policies is determined by the permissions of the view owner. However, if the view has security_invoker set to true , then the policies and permissions of the invoking user are used instead, as if the base relations had been referenced directly from the query using the view.", "Functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore, the user of a view must have permissions to call all functions used by the view. Functions in the view are executed with the privileges of the user executing the query or the function owner, depending on whether the functions are defined as SECURITY INVOKER or SECURITY DEFINER . Thus, for example, calling CURRENT_USER directly in a view will always return the invoking user, not the view owner. This is not affected by the view's security_invoker setting, and so a view with security_invoker set to false is not equivalent to a SECURITY DEFINER function and those concepts should not be confused.", "Note that the user performing the insert, update or delete on the view must have the corresponding insert, update or delete privilege on the view. In addition, by default, the view's owner must have the relevant privileges on the underlying base relations, whereas the user performing the update does not need any permissions on the underlying base relations (see Section 39.5 ). However, if the view has security_invoker set to true , the user performing the update, rather than the view owner, must have the relevant privileges on the underlying base relations."]}], "signature": "WITH (security_invoker = value)", "description": ["This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. See the notes below for full details."]}, "18": {"facts": [{"label": "Applies to", "value": "View options"}, {"label": "Value type", "value": "boolean"}], "related": [{"url": "/docs/sql/create-view/?v=18", "label": "CREATE VIEW"}], "release": {"ref": "Local English manual 18.6", "label": "18.6", "major": "18", "channel": "stable", "revision": "eb6c2292fdf28e1b4635ab478eec3919411cdf4a6c07553387870e26201f3744"}, "sources": [{"url": "/docs/18/sql-createview.html", "path": "sql-createview.html", "label": "PostgreSQL 18 English manual", "sha256": "0c11551250a39c2136437e8cded6bcb5bb8d324fa60b9b2e86b2276ad60ee599"}], "sections": [{"title": "View options", "paragraphs": ["Views do not store query results. Set these security or update semantics with CREATE VIEW WITH or ALTER VIEW."]}, {"title": "Security semantics", "paragraphs": ["If the view has the security_invoker property set to true , access to the underlying base relations is determined by the permissions of the user executing the query, rather than the view owner. Thus, the user of a security invoker view must have the relevant permissions on the view and its underlying base relations.", "If any of the underlying base relations is a security invoker view, it will be treated as if it had been accessed directly from the original query. Thus, a security invoker view will always check its underlying base relations using the permissions of the current user, even if it is accessed from a view without the security_invoker property.", "If any of the underlying base relations has row-level security enabled, then by default, the row-level security policies of the view owner are applied, and access to any additional relations referred to by those policies is determined by the permissions of the view owner. However, if the view has security_invoker set to true , then the policies and permissions of the invoking user are used instead, as if the base relations had been referenced directly from the query using the view.", "Functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore, the user of a view must have permissions to call all functions used by the view. Functions in the view are executed with the privileges of the user executing the query or the function owner, depending on whether the functions are defined as SECURITY INVOKER or SECURITY DEFINER . Thus, for example, calling CURRENT_USER directly in a view will always return the invoking user, not the view owner. This is not affected by the view's security_invoker setting, and so a view with security_invoker set to false is not equivalent to a SECURITY DEFINER function and those concepts should not be confused.", "Note that the user performing the insert, update or delete on the view must have the corresponding insert, update or delete privilege on the view. In addition, by default, the view's owner must have the relevant privileges on the underlying base relations, whereas the user performing the update does not need any permissions on the underlying base relations (see Section 39.5 ). However, if the view has security_invoker set to true , the user performing the update, rather than the view owner, must have the relevant privileges on the underlying base relations."]}], "signature": "WITH (security_invoker = value)", "description": ["This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. See the notes below for full details."]}, "19": {"facts": [{"label": "Applies to", "value": "View options"}, {"label": "Value type", "value": "boolean"}], "related": [{"url": "/docs/sql/create-view/?v=19", "label": "CREATE VIEW"}], "release": {"ref": "Local English manual 19 beta 4", "label": "19 beta 4", "major": "19", "channel": "preview", "revision": "df6d20830d1a09734a2db6ffc3a6138ce80e669294e56a30f6b5d4a89d81aef1"}, "sources": [{"url": "/docs/19/sql-createview.html", "path": "sql-createview.html", "label": "PostgreSQL 19 English manual", "sha256": "eb32d7fd0cdf4f868af1a1a1c866aabe70295e50e327b97c9577a944a6092a79"}], "sections": [{"title": "View options", "paragraphs": ["Views do not store query results. Set these security or update semantics with CREATE VIEW WITH or ALTER VIEW."]}, {"title": "Security semantics", "paragraphs": ["If the view has the security_invoker property set to true , access to the underlying base relations is determined by the permissions of the user executing the query, rather than the view owner. Thus, the user of a security invoker view must have the relevant permissions on the view and its underlying base relations.", "If any of the underlying base relations is a security invoker view, it will be treated as if it had been accessed directly from the original query. Thus, a security invoker view will always check its underlying base relations using the permissions of the current user, even if it is accessed from a view without the security_invoker property.", "If any of the underlying base relations has row-level security enabled, then by default, the row-level security policies of the view owner are applied, and access to any additional relations referred to by those policies is determined by the permissions of the view owner. However, if the view has security_invoker set to true , then the policies and permissions of the invoking user are used instead, as if the base relations had been referenced directly from the query using the view.", "Functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore, the user of a view must have permissions to call all functions used by the view. Functions in the view are executed with the privileges of the user executing the query or the function owner, depending on whether the functions are defined as SECURITY INVOKER or SECURITY DEFINER . Thus, for example, calling CURRENT_USER directly in a view will always return the invoking user, not the view owner. This is not affected by the view's security_invoker setting, and so a view with security_invoker set to false is not equivalent to a SECURITY DEFINER function and those concepts should not be confused.", "Note that the user performing the insert, update or delete on the view must have the corresponding insert, update or delete privilege on the view. In addition, by default, the view's owner must have the relevant privileges on the underlying base relations, whereas the user performing the update does not need any permissions on the underlying base relations (see Section 39.5 ). However, if the view has security_invoker set to true , the user performing the update, rather than the view owner, must have the relevant privileges on the underlying base relations."]}], "signature": "WITH (security_invoker = value)", "description": ["This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. See the notes below for full details."]}, "20": {"facts": [{"label": "Applies to", "value": "View options"}, {"label": "Value type", "value": "boolean"}], "related": [{"url": "/docs/sql/create-view/?v=20", "label": "CREATE VIEW"}], "release": {"ref": "2c10c2ce4d7bcd57543a49ab402af02a39724e0a", "label": "20 devel", "major": "20", "channel": "devel", "revision": "ca199fbaaf6c4bd29cd5a98beaf34d9f4141c15d2f94d1d0202f3204ef18d09f"}, "sources": [{"url": "/docs/devel/sql-createview.html", "path": "sql-createview.html", "label": "PostgreSQL 20 English manual", "sha256": "ab4714c547b7e5dc1c3730b0702032f40e58945b0078a5ea5de9f8644c1154ee"}], "sections": [{"title": "View options", "paragraphs": ["Views do not store query results. Set these security or update semantics with CREATE VIEW WITH or ALTER VIEW."]}, {"title": "Security semantics", "paragraphs": ["If the view has the security_invoker property set to true , access to the underlying base relations is determined by the permissions of the user executing the query, rather than the view owner. Thus, the user of a security invoker view must have the relevant permissions on the view and its underlying base relations.", "If any of the underlying base relations is a security invoker view, it will be treated as if it had been accessed directly from the original query. Thus, a security invoker view will always check its underlying base relations using the permissions of the current user, even if it is accessed from a view without the security_invoker property.", "If any of the underlying base relations has row-level security enabled, then by default, the row-level security policies of the view owner are applied, and access to any additional relations referred to by those policies is determined by the permissions of the view owner. However, if the view has security_invoker set to true , then the policies and permissions of the invoking user are used instead, as if the base relations had been referenced directly from the query using the view.", "Functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore, the user of a view must have permissions to call all functions used by the view. Functions in the view are executed with the privileges of the user executing the query or the function owner, depending on whether the functions are defined as SECURITY INVOKER or SECURITY DEFINER . Thus, for example, calling CURRENT_USER directly in a view will always return the invoking user, not the view owner. This is not affected by the view's security_invoker setting, and so a view with security_invoker set to false is not equivalent to a SECURITY DEFINER function and those concepts should not be confused.", "Note that the user performing the insert, update or delete on the view must have the corresponding insert, update or delete privilege on the view. In addition, by default, the view's owner must have the relevant privileges on the underlying base relations, whereas the user performing the update does not need any permissions on the underlying base relations (see Section 39.5 ). However, if the view has security_invoker set to true , the user performing the update, rather than the view owner, must have the relevant privileges on the underlying base relations."]}], "signature": "WITH (security_invoker = value)", "description": ["This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. See the notes below for full details."]}}, "content_hash": "222e2bddb87cde75bfbe3845d01d21f69886ec6e9ca1dc730e6fe80ef9c65c7c", "imported_at": "2026-09-27T09:57:59.037"}, "snapshot": {"facts": [{"label": "Applies to", "value": "View options"}, {"label": "Value type", "value": "boolean"}], "related": [{"url": "/docs/sql/create-view/?v=18", "label": "CREATE VIEW"}], "release": {"ref": "Local English manual 18.6", "label": "18.6", "major": "18", "channel": "stable", "revision": "eb6c2292fdf28e1b4635ab478eec3919411cdf4a6c07553387870e26201f3744"}, "sources": [{"url": "/docs/18/sql-createview.html", "path": "sql-createview.html", "label": "PostgreSQL 18 English manual", "sha256": "0c11551250a39c2136437e8cded6bcb5bb8d324fa60b9b2e86b2276ad60ee599"}], "sections": [{"title": "View options", "paragraphs": ["Views do not store query results. Set these security or update semantics with CREATE VIEW WITH or ALTER VIEW."]}, {"title": "Security semantics", "paragraphs": ["If the view has the security_invoker property set to true , access to the underlying base relations is determined by the permissions of the user executing the query, rather than the view owner. Thus, the user of a security invoker view must have the relevant permissions on the view and its underlying base relations.", "If any of the underlying base relations is a security invoker view, it will be treated as if it had been accessed directly from the original query. Thus, a security invoker view will always check its underlying base relations using the permissions of the current user, even if it is accessed from a view without the security_invoker property.", "If any of the underlying base relations has row-level security enabled, then by default, the row-level security policies of the view owner are applied, and access to any additional relations referred to by those policies is determined by the permissions of the view owner. However, if the view has security_invoker set to true , then the policies and permissions of the invoking user are used instead, as if the base relations had been referenced directly from the query using the view.", "Functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore, the user of a view must have permissions to call all functions used by the view. Functions in the view are executed with the privileges of the user executing the query or the function owner, depending on whether the functions are defined as SECURITY INVOKER or SECURITY DEFINER . Thus, for example, calling CURRENT_USER directly in a view will always return the invoking user, not the view owner. This is not affected by the view's security_invoker setting, and so a view with security_invoker set to false is not equivalent to a SECURITY DEFINER function and those concepts should not be confused.", "Note that the user performing the insert, update or delete on the view must have the corresponding insert, update or delete privilege on the view. In addition, by default, the view's owner must have the relevant privileges on the underlying base relations, whereas the user performing the update does not need any permissions on the underlying base relations (see Section 39.5 ). However, if the view has security_invoker set to true , the user performing the update, rather than the view owner, must have the relevant privileges on the underlying base relations."]}], "signature": "WITH (security_invoker = value)", "description": ["This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. See the notes below for full details."]}, "comparison": {"left": "14", "right": "15", "status": "added", "diff": "--- PostgreSQL 14\n+++ PostgreSQL 15\n@@ -1 +1,14 @@\n-Not recorded in this version\n+{\n+  \"facts\": [\n+    {\n+      \"label\": \"Applies to\",\n+      \"value\": \"View options\"\n+    },\n+    {\n+      \"label\": \"Value type\",\n+      \"value\": \"boolean\"\n+    }\n+  ],\n+  \"signature\": \"WITH (security_invoker = value)\",\n+  \"tables\": null\n+}"}}