This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-17. For the latest, interactive version please visit https://mariadb.com/kb/.

Comment removed after upgrading MariaDB from 10.3.34 to 10.6.15

Our MariaDB has been upgraded. (10.3.34 -> 10.6.15)

After upgrading, the following problem occurred.

The following code creates a simple function.

DROP FUNCTION IF EXISTS XADD;
DELIMITER //
CREATE FUNCTION XADD(
/* COMMENT #1 :: This will be removed at 10.6.15 but preserved at 10.3.34 */
-- COMMENT #2 :: This will be removed at 10.6.15 but preserved at 10.3.34
  AParamOne           INTEGER UNSIGNED,   -- COMMENT #3 :: This will be preserved at both of 10.6.15 and 10.3.34
  AParamTwo           INTEGER UNSIGNED    /* COMMENT #4 :: This will be preserved at both of 10.6.15 and 10.3.34 */
) RETURNS INTEGER UNSIGNED
BEGIN
  RETURN AParamOne + AParamTwo;
END;
//
DELIMITER ;

As explained in the code comments, each comment #1, #2, #3, #4 is preserved normally in 10.3.34.

But 10.6.15, comments #1 and #2 will be removed.

Not only is it removed, but it also breaks the indentation of the function code.

This is the result of running the above code on 10.6.15.

CREATE FUNCTION XADD(AParamOne           INTEGER UNSIGNED,   -- COMMENT #3 :: This will be preserved at both of 10.6.15 and 10.3.34
  AParamTwo           INTEGER UNSIGNED    /* COMMENT #4 :: This will be preserved at both of 10.6.15 and 10.3.34 */
) RETURNS int(10) unsigned
BEGIN
  RETURN AParamOne + AParamTwo;
END

This is the result of running the above code on 10.3.34.

CREATE FUNCTION XADD(
/* COMMENT #1 :: This will be removed at 10.6.15 but preserved at 10.3.34 */
-- COMMENT #2 :: This will be removed at 10.6.15 but preserved at 10.3.34
  AParamOne           INTEGER UNSIGNED,   -- COMMENT #3 :: This will be preserved at both of 10.6.15 and 10.3.34
  AParamTwo           INTEGER UNSIGNED    /* COMMENT #4 :: This will be preserved at both of 10.6.15 and 10.3.34 */
) RETURNS int(10) unsigned
BEGIN
  RETURN AParamOne + AParamTwo;
END

As you can see, in 10.3.34 you can even indent function code without any problems. Comments are being preserved well.

This causes serious problems for users.

If the user writes important information in a comment and wants to keep it in the function code, It is currently not possible to write comments in the above style.

Even though it can be done without any problem in 10.3.34

Is this behavior as intended in 10.6.15?

Or is it a bug?

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.