Skip to content
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

parser: Fix undocumented password_func function | tidb-test=pr/2458 #58312

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Dec 16, 2024

What problem does this PR solve?

Issue Number: close #58311

Problem Summary:

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

The undocumented `password_func` function was removed.

@ti-chi-bot ti-chi-bot bot added do-not-merge/invalid-title release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/needs-triage-completed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 16, 2024
Copy link

tiprow bot commented Dec 16, 2024

Hi @dveeden. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@dveeden dveeden changed the title Fix undocumented password_func function parser: Fix undocumented password_func function Dec 16, 2024
@dveeden
Copy link
Contributor Author

dveeden commented Dec 16, 2024

/check-issue-triage-complete

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.8616%. Comparing base (a3c9b79) to head (343601d).
Report is 3 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58312        +/-   ##
================================================
+ Coverage   73.5693%   73.8616%   +0.2923%     
================================================
  Files          1680       1710        +30     
  Lines        463726     471136      +7410     
================================================
+ Hits         341160     347989      +6829     
+ Misses       101733     101619       -114     
- Partials      20833      21528       +695     
Flag Coverage Δ
integration 45.9586% <ø> (?)
unit 72.3347% <ø> (-0.0020%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 45.9807% <ø> (+0.0268%) ⬆️

@dveeden dveeden changed the title parser: Fix undocumented password_func function parser: Fix undocumented password_func function | tidb-test=pr/2458 Dec 16, 2024
@dveeden
Copy link
Contributor Author

dveeden commented Dec 16, 2024

/retest

Copy link

tiprow bot commented Dec 16, 2024

@dveeden: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@dveeden
Copy link
Contributor Author

dveeden commented Dec 16, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Dec 16, 2024
@Defined2014
Copy link
Contributor

Defined2014 commented Dec 17, 2024

This function is deprecated in MySQL 5.7 and is removed in MySQL 8.0.

Should we rename it to password or just remove it?

I found it included by #2680, @XuHuaiyu PTAL

@dveeden
Copy link
Contributor Author

dveeden commented Dec 17, 2024

This function is deprecated in MySQL 5.7 and is removed in MySQL 8.0.

Should we rename it to password or just remove it?

I found it included by #2680, @XuHuaiyu PTAL

mysql-8.0.11-TiDB-v8.5.0-alpha-356-gdbd4eeaaf2> \W
Show warnings enabled.
mysql-8.0.11-TiDB-v8.5.0-alpha-356-gdbd4eeaaf2> select password("abc");
+-------------------------------------------+
| password("abc")                           |
+-------------------------------------------+
| *0D3CED9BEC10A777AEC23CCC353A8C08A633045E |
+-------------------------------------------+
1 row in set, 1 warning (0.00 sec)

Warning (Code 1681): PASSWORD is deprecated and will be removed in a future release.

MySQL has removed this function and in TiDB it has been deprecated. I'm ok to remove password(), but that should probably be done in a separate PR.

Note that password() and password_func() behave the same and are basically the same. I think it was never meant to be two separate things. So we don't need to rename things.

See also this from the diff:

diff --git a/pkg/parser/parser_test.go b/pkg/parser/parser_test.go
index 7e60aaabb4..d5601e6915 100644
--- a/pkg/parser/parser_test.go
+++ b/pkg/parser/parser_test.go
@@ -2258 +2258 @@ func TestBuiltin(t *testing.T) {
-               {`SELECT PASSWORD(@str);`, true, "SELECT PASSWORD_FUNC(@`str`)"},
+               {`SELECT PASSWORD(@str);`, true, "SELECT PASSWORD(@`str`)"},

So running PASSWORD() through the parser and returning it gives PASSWORD_FUNC()

@dveeden dveeden requested a review from D3Hunter December 17, 2024 06:50
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 17, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 17, 2024
Copy link

ti-chi-bot bot commented Dec 17, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-17 08:19:42.585785399 +0000 UTC m=+944972.674587929: ☑️ agreed by Defined2014.
  • 2024-12-17 15:42:24.125594974 +0000 UTC m=+971534.214397516: ☑️ agreed by mjonss.

Copy link
Contributor

@D3Hunter D3Hunter left a comment

Choose a reason for hiding this comment

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

our doc also contains password_func, see https://docs.pingcap.com/tidb/stable/sql-statement-show-builtins, this pr breaks this, but seems trivial

rest lgtm

@dveeden
Copy link
Contributor Author

dveeden commented Dec 18, 2024

our doc also contains password_func, see https://docs.pingcap.com/tidb/stable/sql-statement-show-builtins, this pr breaks this, but seems trivial

rest lgtm

I won't really call this documentation as it is just example output of SHOW BUILTINS. However this does mean that after this PR we need to update this page. I'll take care of that.

The output of SHOW BUILTINS also demonstrates an issue fixed by this PR:

With v8.4.0

mysql-8.0.11-TiDB-v8.4.0> pager grep password
PAGER set to 'grep password'
mysql-8.0.11-TiDB-v8.4.0> show builtins;
| old_password                |
| password_func               |
| validate_password_strength  |
303 rows in set (0.01 sec)

mysql-8.0.11-TiDB-v8.4.0> pager
Default pager wasn't set, using stdout.
mysql-8.0.11-TiDB-v8.4.0> SELECT old_password("abc");
ERROR 1305 (42000): FUNCTION OLD_PASSWORD does not exist
mysql-8.0.11-TiDB-v8.4.0> SELECT password_func("abc");
+-------------------------------------------+
| password_func("abc")                      |
+-------------------------------------------+
| *0D3CED9BEC10A777AEC23CCC353A8C08A633045E |
+-------------------------------------------+
1 row in set, 1 warning (0.01 sec)

mysql-8.0.11-TiDB-v8.4.0> SELECT password("abc");
+-------------------------------------------+
| password("abc")                           |
+-------------------------------------------+
| *0D3CED9BEC10A777AEC23CCC353A8C08A633045E |
+-------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql-8.0.11-TiDB-v8.4.0>
  • OLD_PASSWORD() is in the output of SHOW BUILTINS, while it shouldn't. This is fixed in expression: cleanup old functions #58327.
  • PASSWORD() is not in the output of SHOW BUILTINS, while it should.
  • password_func() is in the output, but otherwise undocumented (and not compatible with MySQL)

With this PR:

mysql-8.0.11-TiDB-v8.5.0-alpha-356-gdbd4eeaaf2> pager grep password
PAGER set to 'grep password'
mysql-8.0.11-TiDB-v8.5.0-alpha-356-gdbd4eeaaf2> show builtins;
| old_password                |
| password                    |
| validate_password_strength  |
303 rows in set (0.00 sec)

mysql-8.0.11-TiDB-v8.5.0-alpha-356-gdbd4eeaaf2> pager
Default pager wasn't set, using stdout.

@D3Hunter
Copy link
Contributor

/approve

@ti-chi-bot ti-chi-bot bot added the approved label Dec 19, 2024
@D3Hunter
Copy link
Contributor

/hold

feel free to unhold after you discuss with frank

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 19, 2024
Copy link

@Frank945946 Frank945946 left a comment

Choose a reason for hiding this comment

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

Please update the corresponding documentation at the same time. The rest LGTM.

Copy link

ti-chi-bot bot commented Dec 19, 2024

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

In response to this:

Please update the corresponding documentation at the same time. The rest 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.

@dveeden
Copy link
Contributor Author

dveeden commented Dec 19, 2024

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 19, 2024
@dveeden
Copy link
Contributor Author

dveeden commented Dec 19, 2024

/retest

@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed approved size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 19, 2024
@dveeden dveeden requested a review from XuHuaiyu December 19, 2024 14:51
Copy link

ti-chi-bot bot commented Dec 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, Defined2014, Frank945946, mjonss, XuHuaiyu

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

The pull request process is described here

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

@ti-chi-bot ti-chi-bot bot added the approved label Dec 20, 2024
@ti-chi-bot ti-chi-bot bot merged commit 85b4656 into pingcap:master Dec 20, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undocumented password_func function
6 participants