Skip to content

*: add column-level masking policy feature document#21454

Open
tiancaiamao wants to merge 45 commits into
masterfrom
column-masking-policy
Open

*: add column-level masking policy feature document#21454
tiancaiamao wants to merge 45 commits into
masterfrom
column-masking-policy

Conversation

@tiancaiamao

@tiancaiamao tiancaiamao commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

First-time contributors' checklist

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions (in Chinese).

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot ti-chi-bot Bot added missing-translation-status This PR does not have translation status info. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 23, 2026
@ti-chi-bot ti-chi-bot Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 23, 2026
@hfxsd hfxsd added translation/doing This PR’s assignee is translating this PR. and removed missing-translation-status This PR does not have translation status info. labels Mar 24, 2026
@qiancai

qiancai commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

@tiancaiamao Please involve a tech reviewer for this PR. Thanks.

@qiancai qiancai added the v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3. label Mar 24, 2026
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
@qiancai qiancai self-assigned this Apr 17, 2026
@tiancaiamao tiancaiamao requested a review from bb7133 May 9, 2026 02:56
@bb7133

bb7133 commented May 9, 2026

Copy link
Copy Markdown
Member

Please address the comments~

@ti-chi-bot

ti-chi-bot Bot commented May 9, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from qiancai. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Co-authored-by: Grace Cai <qqzczy@126.com>
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Co-authored-by: Grace Cai <qqzczy@126.com>
@tiancaiamao tiancaiamao requested a review from qiancai May 20, 2026 08:39
@pingcap-cla-assistant

pingcap-cla-assistant Bot commented May 29, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
8 out of 9 committers have signed the CLA.

✅ xhebox
✅ tiancaiamao
✅ wlwilliamx
✅ yibin87
✅ qiancai
✅ solotzg
✅ Oreoxmt
✅ hfxsd
❌ Test User


Test User seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Test User and others added 2 commits May 29, 2026 13:29
# Conflicts:
#	sql-statements/sql-statement-overview.md
Add SQL statement docs for the column-level data masking feature:

- New: sql-statement-create-masking-policy.md (CREATE MASKING POLICY)
- New: sql-statement-show-masking-policies.md (SHOW MASKING POLICIES)
- Updated: sql-statement-alter-table.md (ADD/DROP/ENABLE/DISABLE/MODIFY MASKING POLICY)
- Updated: sql-statement-overview.md (add masking entries to DDL and SHOW tables)
- Updated: TOC.md (add new statement entries)

Refs: #21454
@tiancaiamao tiancaiamao force-pushed the column-masking-policy branch from ee1411a to 6f7e786 Compare May 29, 2026 07:12
@tiancaiamao

Copy link
Copy Markdown
Contributor Author

Add sql-statement related part, PTAL @qiancai

Comment thread sql-statements/sql-statement-alter-table.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-alter-table.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-show-masking-policies.md Outdated
Comment thread sql-statements/sql-statement-show-masking-policies.md Outdated
Comment thread sql-statements/sql-statement-show-masking-policies.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated

@qiancai qiancai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

Comment thread privilege-management.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 8, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-06-08 08:06:35.181916609 +0000 UTC m=+774496.252233989: ☑️ agreed by qiancai.

Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
- **返回规则**
- **字符串** → 返回相同长度的字符串,所有字符替换为 `'X'`
- **日期/DATETIME/TIMESTAMP** → 返回 `1970-01-01`(保留原始类型和小数秒精度)
- **Duration** → 返回 `00:00:00`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD.

Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
- **字符串类型**:`VARCHAR`、`CHAR`、`TEXT` 及其变体
- **二进制类型**:`BINARY`、`VARBINARY`、`BLOB`
- **日期和时间类型**:`DATE`、`TIME`、`DATETIME`、`TIMESTAMP`、`YEAR`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里要加一个 bullet,写数值类型吗?

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不支持数值类型

支持这些:

  • VARCHAR, CHAR, TEXT(TINYTEXT, MEDIUMTEXT, LONGTEXT), BLOB(TINYBLOB, MEDIUMBLOB, LONGBLOB)
    • For the LONGTEXT and BLOB types, full masking (full redaction) or NULL masking needs to be supported.
  • DATE, TIME,DATETIME,TIMESTAMP,YEAR

Comment thread column-level-masking-policy.md Outdated
Comment thread column-level-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
Comment thread sql-statements/sql-statement-alter-table.md Outdated
Comment thread sql-statements/sql-statement-show-masking-policies.md Outdated
Comment thread sql-statements/sql-statement-show-masking-policies.md Outdated
Comment thread sql-statements/sql-statement-create-masking-policy.md Outdated
qiancai and others added 2 commits June 10, 2026 13:02
Co-authored-by: Grace Cai <qqzczy@126.com>
@tiancaiamao

Copy link
Copy Markdown
Contributor Author

PTAL @bb7133

@expxiaoli expxiaoli left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot

ti-chi-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

@expxiaoli: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

LGTM

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tiancaiamao

Copy link
Copy Markdown
Contributor Author

/retest

Comment thread column-level-masking-policy.md Outdated
@ti-chi-bot

ti-chi-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

@tiancaiamao: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-verify 638c43c link true /test pull-verify

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. translation/doing This PR’s assignee is translating this PR. v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.