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

Local routine MEDIUMBLOB variable overwritten while asigning value to another MEDIUMBLOB variable using SELECT INTO

    Details

      Description

      Using SELECT INTO local routine variable, value is assigned to two distinct variables.

      Test cast to reproduce issue;

      Two tables with one row with different values


      CREATE TABLE `test`.`A`(  
        `idA` BIGINT NOT NULL AUTO_INCREMENT,
        `messageA` MEDIUMBLOB,
        PRIMARY KEY (`idA`)
      );
       
      CREATE TABLE `test`.`B`(  
        `idB` BIGINT NOT NULL AUTO_INCREMENT,
        `messageB` MEDIUMBLOB,
        PRIMARY KEY (`idB`)
      );
       
      INSERT INTO A(messageA) VALUES (COMPRESS('messageA'));
      INSERT INTO B(messageB) VALUES (COMPRESS('messageB'));
      
      


      Stored procedure:


      DELIMITER $$
       
      CREATE PROCEDURE `procC`()
      BEGIN
      	DECLARE pA MEDIUMBLOB;
      	DECLARE pB MEDIUMBLOB;
      	
      	SElect messageA
      	into pA 
      	FROM A;
      	
      	SELECT messageB
      	into pB
      	from B;
      	
      	select UNCOMPRESS(pA), UNCOMPRESS(pB);
          END$$
       
      DELIMITER ;
      
      

      Calling procedure:

      CALL procC();
      
      


      Expected result:

      messageA, messageB
      

      Result:

      messageB, messageB
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ljubomir.djokic Ljubomir Đokić
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: