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

CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.3, 10.3.9
    • Fix Version/s: 10.3.11
    • Component/s: Stored routines
    • Labels:
      None
    • Environment:
      CentOS7

      Description

      The following code in a stored procedure produces the correct result when CALLed:

      	FOR rec IN (SELECT Orders.Order_ID, Customers.State FROM Orders join Customers using (Customer_ID) where State is not null) DO
      		set ans = concat(ans, '/', rec.Order_ID, '-', rec.State);
      	END FOR;
      

      However, if the field list is replaced by * it just crashes the server:

      	FOR rec IN (SELECT * FROM Orders join Customers using (Customer_ID) where State is not null) DO
      		set ans = concat(ans, '/', rec.Order_ID, '-', rec.State);
      	END FOR;
      

      with the message:

      ERROR: (conn=10) unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                rdyas Robert Dyas
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: