Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-31736

Create native function for format_bytes

Details

    Description

      There is already on going contribution PR 2578

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment - rebased https://github.com/mariaDB/server/pull/3137 on to main.
            wlad Vladislav Vaintroub added a comment - - edited

            Can we remove sys.format_bytes(), since native function is there, by removing scripts/sys_schema/functions/format_bytes.sql

            There is a plenty of

            Warnings:
            Note	1585	This function 'format_bytes' has the same name as a native function
            

            in the test results. Apparently, every query touching INFORMATION_SCHEMA.ROUTINES would produce such a warning

            This is confusing for the users.

            Alternatively, do not warn about it in I_S routines. Unless users are actually calling this function, there is no need. Whole MySQL 8.0 suite only has this warning exactly once, when sys.format_bytes is used inside SELECT, but not for every mysqldump invocation.

            wlad Vladislav Vaintroub added a comment - - edited Can we remove sys.format_bytes(), since native function is there, by removing scripts/sys_schema/functions/format_bytes.sql There is a plenty of Warnings: Note 1585 This function 'format_bytes' has the same name as a native function in the test results. Apparently, every query touching INFORMATION_SCHEMA.ROUTINES would produce such a warning This is confusing for the users. Alternatively, do not warn about it in I_S routines. Unless users are actually calling this function, there is no need. Whole MySQL 8.0 suite only has this warning exactly once , when sys.format_bytes is used inside SELECT, but not for every mysqldump invocation.

            may be somebody is using it?

            perhaps almost nobody, then we can remove it and advise users who need it to do

            CREATE FUNCTION format_bytes (bytes TEXT) RETURNS TEXT DETERMINISTIC RETURN format_bytes(bytes);
            

            or, to be really conservative, keep it and tone down the warning.

            serg Sergei Golubchik added a comment - may be somebody is using it? perhaps almost nobody, then we can remove it and advise users who need it to do CREATE FUNCTION format_bytes (bytes TEXT) RETURNS TEXT DETERMINISTIC RETURN format_bytes(bytes); or, to be really conservative, keep it and tone down the warning.
            alice Alice Sherepa added a comment -

            please fix the test for ps-protocol (also warnings in --view-protocol, cursor-protocol)

            ./mtr sysschema.fn_format_bytes --ps-protocol
            Logging: ./mtr  sysschema.fn_format_bytes --ps-protocol
             
            sysschema.fn_format_bytes                [ fail ]
                    Test ended at 2024-11-22 15:24:40
             
            CURRENT_TEST: sysschema.fn_format_bytes
            --- /home/alice/git/11/mysql-test/suite/sysschema/r/fn_format_bytes.result	2024-11-18 15:33:34.973916397 +0100
            +++ /home/alice/git/11/mysql-test/suite/sysschema/r/fn_format_bytes.reject	2024-11-22 15:24:40.291045920 +0100
            @@ -1,8 +1,6 @@
             SELECT sys.format_bytes(NULL);
             sys.format_bytes(NULL)
             NULL
            -Warnings:
            -Note	1585	This function 'format_bytes' has the same name as a native function
             SELECT sys.format_bytes(1);
             sys.format_bytes(1)
             1 bytes
             
            Result length mismatch
            

            alice Alice Sherepa added a comment - please fix the test for ps-protocol (also warnings in --view-protocol, cursor-protocol) ./mtr sysschema.fn_format_bytes --ps-protocol Logging: ./mtr sysschema.fn_format_bytes --ps-protocol   sysschema.fn_format_bytes [ fail ] Test ended at 2024-11-22 15:24:40   CURRENT_TEST: sysschema.fn_format_bytes --- /home/alice/git/11/mysql-test/suite/sysschema/r/fn_format_bytes.result 2024-11-18 15:33:34.973916397 +0100 +++ /home/alice/git/11/mysql-test/suite/sysschema/r/fn_format_bytes.reject 2024-11-22 15:24:40.291045920 +0100 @@ -1,8 +1,6 @@ SELECT sys.format_bytes(NULL); sys.format_bytes(NULL) NULL -Warnings: -Note 1585 This function 'format_bytes' has the same name as a native function SELECT sys.format_bytes(1); sys.format_bytes(1) 1 bytes   Result length mismatch
            alice Alice Sherepa added a comment -

            Ok to push into 11.8 (bb-11.8-bar-MDEV-31736-format_bytes e332642a3450ef24e69a2183c2f505f0fefd8b54)

            alice Alice Sherepa added a comment - Ok to push into 11.8 (bb-11.8-bar- MDEV-31736 -format_bytes e332642a3450ef24e69a2183c2f505f0fefd8b54)

            People

              bar Alexander Barkov
              anel Anel Husakovic
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.