-
Notifications
You must be signed in to change notification settings - Fork 6k
*: adapt the show columns
, show index
and rename
for column privilege
#61679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-8.5-20250606-v8.5.2
Are you sure you want to change the base?
*: adapt the show columns
, show index
and rename
for column privilege
#61679
Conversation
show columns
, show index
and rename
for column privilege
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-8.5-20250606-v8.5.2 #61679 +/- ##
================================================================
Coverage ? 57.0151%
================================================================
Files ? 1770
Lines ? 629075
Branches ? 0
================================================================
Hits ? 358668
Misses ? 246281
Partials ? 24126
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
/retest |
1 similar comment
/retest |
show columns
, show index
and rename
for column privilegeshow columns
, show index
, show bindings
and rename
for column privilege
de1990f
to
7e9852a
Compare
This reverts commit 7e9852a.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
show columns
, show index
, show bindings
and rename
for column privilegeshow columns
, show index
and rename
for column privilege
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adapts the behavior of the "show columns", "show index", and "rename" functionalities to properly enforce column-specific privileges. It updates integration tests, error expectations, privilege checking logic in executor code, and refactors user/host retrieval in the authentication module.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/integrationtest/t/executor/show.test | Adds integration tests for column and index privilege enforcement. |
tests/integrationtest/r/executor/show.result | Updates expected outputs for the new privilege behaviors. |
pkg/parser/auth/auth.go | Introduces GetUserAndHostName for consistent user/host extraction. |
pkg/executor/simple.go | Renames user privileges in the mysql.columns_priv table. |
pkg/executor/show.go | Implements column-level privilege checks for SHOW queries. |
create table test_show_columns_db.t (a int, b int); | ||
|
||
--echo // no grant would report error | ||
connect (test_show_columns_user, localhost, test_show_columns_user,,); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The connection command contains a double comma which may indicate an empty parameter (such as an empty password). Consider adding a clarifying comment if this is intentional to improve readability.
connect (test_show_columns_user, localhost, test_show_columns_user,,); | |
connect (test_show_columns_user, localhost, test_show_columns_user,,); -- The double comma indicates an empty password for the connection. |
Copilot uses AI. Check for mistakes.
@@ -717,6 +723,13 @@ func (e *ShowExec) fetchShowColumns(ctx context.Context) error { | |||
} else if fieldPatternsLike != nil && !fieldPatternsLike.DoMatch(col.Name.L) { | |||
continue | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Clarify via an inline comment that when table-level privileges are not granted, the code proceeds to check each column for specific privileges, with passColPrivCheck set when at least one column passes. This will help future maintainers understand the dual privilege check logic.
} | |
} | |
// If table-level privileges are not granted, proceed to check column-level privileges. | |
// Set passColPrivCheck to true if at least one column passes the privilege check. |
Copilot uses AI. Check for mistakes.
What problem does this PR solve?
Issue Number: ref #61706
Problem Summary:
What changed and how does it work?
Adapt the show columns, show index and rename for column privilege
This PR pick
pkg/executor/show.go
,pkg/executor/simple.go
,pkg/parser/auth/auth.go
,tests/integrationtest/t/executor/show.test
andtests/integrationtest/r/executor/show.result
in #61638Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.