v.24.2New Feature

Added Definer User Syntax for Views/Materialized Views in ClickHouse

Added new syntax which allows to specify definer user in View/Materialized View. This allows to execute selects/inserts from views without explicit grants for underlying tables. So, a View will encapsulate the grants. #54901 #60439 (pufit).
Added syntax to specify a definer user for Views and Materialized Views in ClickHouse, enabling them to execute queries with encapsulated grants.

Why it matters

This feature allows Views and Materialized Views to run SELECT and INSERT operations without requiring explicit grants on underlying tables for the querying user. It improves security and simplifies permission management by encapsulating access rights within the view definition.

How to use it

When creating a View or Materialized View, specify the definer user using the new syntax to encapsulate permissions. This enables the view to execute with the privileges of the definer user rather than the querying user.

Example:

CREATE VIEW view_name DEFINER = 'user_name' AS <select_statement>;