[Doc] Add references for sys.policy_references (backport #63183) (#63211)

Co-authored-by: 絵空事スピリット <wanglichen@starrocks.com>
This commit is contained in:
mergify[bot] 2025-09-17 01:57:34 +00:00 committed by GitHub
parent fe9067d503
commit dccca50e33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 171 additions and 14 deletions

View File

@ -0,0 +1,6 @@
:::note
This view applies to a feature not available in StarRocks.
:::

View File

@ -0,0 +1,46 @@
---
displayed_sidebar: docs
---
# policy_references
import FeatureAvailability from '../../_assets/commonMarkdown/_feature_availability.mdx'
<FeatureAvailability />
You can view the objects row access policies and column masking policies reference by querying the view `policy_references`.
The following fields are provided in `policy_references`:
| **Field** | **Description** |
| ------------------- | ---------------------------------------------------------------------------------------------- |
| POLICY_DATABASE | The database where the policy is located. The namespace of the policy is the database, which is allowed only under `default_catalog`. |
| POLICY_NAME | The name of the policy. |
| POLICY_TYPE | The type of the policy. Valid values: `Row Access` and `Column Masking`. |
| REF_CATALOG | The catalog where the policy is referenced. |
| REF_DATABASE | The database where the policy is referenced. |
| REF_OBJECT_NAME | The table where the policy is referenced. |
| REF_COLUMN | The column where the policy is referenced. This field is always NULL for row access policies. |
Example:
```SQL
mysql > SELECT * FROM policy_references\G
*************************** 1. row ***************************
POLICY_DATABASE: test_db
POLICY_NAME: region_data
POLICY_TYPE: Row Access
REF_CATALOG: default_catalog
REF_DATABASE: test_db
REF_OBJECT_NAME: test1 -- 表名
REF_COLUMN: NULL
*************************** 2. row ***************************
POLICY_DATABASE: test_db
POLICY_NAME: phone_mask
POLICY_TYPE: Column Masking
REF_CATALOG: default_catalog
REF_DATABASE: test_db
REF_OBJECT_NAME: test
REF_COLUMN: phone
2 rows in set (0.03 sec)
```

View File

@ -54,12 +54,13 @@ OBJECT_DATABASE: NULL
`sys` contains the following metadata views:
| **View** | **Description** |
| -------------------- | ----------------------------------------------------------------------------- |
| [grants_to_roles](../sys/grants_to_roles.md) | Records the information of privileges that are granted to user-defined roles. |
| [grants_to_users](../sys/grants_to_users.md) | Records the information of privileges that are granted to users. |
| [role_edges](../sys/role_edges.md) | Records the grantees of roles. |
| [object_dependencies](../sys/object_dependencies.md) | Records the dependency relationship of asynchronous materialized views. |
| **View** | **Description** |
| ----------------------------------------------- | ----------------------------------------------------------------------------- |
| [grants_to_roles](./grants_to_roles.md) | Records the information of privileges that are granted to user-defined roles. |
| [grants_to_users](./grants_to_users.md) | Records the information of privileges that are granted to users. |
| [role_edges](./role_edges.md) | Records the grantees of roles. |
| [object_dependencies](./object_dependencies.md) | Records the dependency relationship of asynchronous materialized views. |
| [policy_references](./policy_references.md) | Records the objects row access policies and column masking policies reference.|
:::note

View File

@ -0,0 +1,5 @@
:::note
このビューは、StarRocks で利用できない機能に適用されます。
:::

View File

@ -0,0 +1,46 @@
---
displayed_sidebar: docs
---
# policy_references
import FeatureAvailability from '../../_assets/commonMarkdown/_feature_availability.mdx'
<FeatureAvailability />
オブジェクトの行アクセスポリシーとカラムマスキングポリシーの参照を、ビュー `policy_references` をクエリすることで確認できます。
`policy_references` には以下のフィールドが提供されています:
| **Field** | **Description** |
| ------------------- | ------------------------------------------------------------------------------------------------- |
| POLICY_DATABASE | ポリシーが所在するデータベース。ポリシーの名前空間はデータベースであり、`default_catalog` のみで許可されます。 |
| POLICY_NAME | ポリシーの名前。 |
| POLICY_TYPE | ポリシーのタイプ。有効な値は `Row Access``Column Masking` です。 |
| REF_CATALOG | ポリシーが参照されるカタログ。 |
| REF_DATABASE | ポリシーが参照されるデータベース。 |
| REF_OBJECT_NAME | ポリシーが参照されるテーブル。 |
| REF_COLUMN | ポリシーが参照されるカラム。このフィールドは行アクセスポリシーの場合、常に NULL です。 |
例:
```SQL
mysql > SELECT * FROM policy_references\G
*************************** 1. row ***************************
POLICY_DATABASE: test_db
POLICY_NAME: region_data
POLICY_TYPE: Row Access
REF_CATALOG: default_catalog
REF_DATABASE: test_db
REF_OBJECT_NAME: test1 -- 表名
REF_COLUMN: NULL
*************************** 2. row ***************************
POLICY_DATABASE: test_db
POLICY_NAME: phone_mask
POLICY_TYPE: Column Masking
REF_CATALOG: default_catalog
REF_DATABASE: test_db
REF_OBJECT_NAME: test
REF_COLUMN: phone
2 rows in set (0.03 sec)
```

View File

@ -56,10 +56,11 @@ OBJECT_DATABASE: NULL
| **View** | **Description** |
| -------------------- | ----------------------------------------------------------------------------- |
| [grants_to_roles](../sys/grants_to_roles.md) | ユーザー定義ロールに付与された特権の情報を記録します。 |
| [grants_to_users](../sys/grants_to_users.md) | ユーザーに付与された特権の情報を記録します。 |
| [role_edges](../sys/role_edges.md) | ロールの被付与者を記録します。 |
| [object_dependencies](../sys/object_dependencies.md) | 非同期マテリアライズドビューの依存関係を記録します。 |
| [grants_to_roles](./grants_to_roles.md) | ユーザー定義ロールに付与された特権の情報を記録します。 |
| [grants_to_users](./grants_to_users.md) | ユーザーに付与された特権の情報を記録します。 |
| [role_edges](./role_edges.md) | ロールの被付与者を記録します。 |
| [object_dependencies](./object_dependencies.md) | 非同期マテリアライズドビューの依存関係を記録します。 |
| [policy_references](./policy_references.md) | オブジェクトの行アクセスポリシーおよび列マスキングポリシーの参照を記録します。|
:::note

View File

@ -0,0 +1,5 @@
:::note
此视图适用于 StarRocks 中不可用的功能。
:::

View File

@ -0,0 +1,46 @@
---
displayed_sidebar: docs
---
# policy_references
import FeatureAvailability from '../../_assets/commonMarkdown/_feature_availability.mdx'
<FeatureAvailability />
您可以通过查询视图 `policy_references` 来查看对象行访问策略和列掩码策略的参考。
`policy_references` 中提供了以下字段:
| **Field** | **Description** |
| ------------------- | ---------------------------------------------------------------------------------------------- |
| POLICY_DATABASE | 策略所在的数据库。策略的命名空间是数据库,仅在 `default_catalog` 下允许。 |
| POLICY_NAME | 策略的名称。 |
| POLICY_TYPE | 策略的类型。有效值:`Row Access` 和 `Column Masking`。 |
| REF_CATALOG | 策略引用的 catalog。 |
| REF_DATABASE | 策略引用的数据库。 |
| REF_OBJECT_NAME | 策略引用的表。 |
| REF_COLUMN | 策略引用的列。对于行访问策略,此字段始终为 NULL。 |
示例:
```SQL
mysql > SELECT * FROM policy_references\G
*************************** 1. row ***************************
POLICY_DATABASE: test_db
POLICY_NAME: region_data
POLICY_TYPE: Row Access
REF_CATALOG: default_catalog
REF_DATABASE: test_db
REF_OBJECT_NAME: test1 -- 表名
REF_COLUMN: NULL
*************************** 2. row ***************************
POLICY_DATABASE: test_db
POLICY_NAME: phone_mask
POLICY_TYPE: Column Masking
REF_CATALOG: default_catalog
REF_DATABASE: test_db
REF_OBJECT_NAME: test
REF_COLUMN: phone
2 rows in set (0.03 sec)
```

View File

@ -56,10 +56,11 @@ OBJECT_DATABASE: NULL
| **视图名** | **描述** |
| ----------------------- | ------------------------------------------------------------- |
| [grants_to_roles](../sys/grants_to_roles.md) | 记录了授予用户自定义角色的权限信息。 |
| [grants_to_users](../sys/grants_to_users.md) | 记录了授予用户的权限信息。 |
| [role_edges](../sys/role_edges.md) | 记录了角色的授予关系。 |
| [object_dependencies](../sys/object_dependencies.md) | 记录了异步物化视图的依赖关系。 |
| [grants_to_roles](./grants_to_roles.md) | 记录了授予用户自定义角色的权限信息。 |
| [grants_to_users](./grants_to_users.md) | 记录了授予用户的权限信息。 |
| [role_edges](./role_edges.md) | 记录了角色的授予关系。 |
| [object_dependencies](./object_dependencies.md) | 记录了异步物化视图的依赖关系。 |
| [policy_references](./policy_references.md) | 记录了行访问策略和列屏蔽策略引用的对象。 |
:::note