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

Variables lost inside TRIGGER procedures

    XMLWordPrintable

    Details

      Description

      Recently problems started to arise while using TRIGGER procedures. If one defines more than one local variable, all become NULL. For example:

      SET @dt=FROM_UNIXTIME(TRIM(BOTH '"' FROM JSON_EXTRACT(NEW.json,'$.rx_time')));
      SET @bs=TRIM(BOTH '"' FROM JSON_EXTRACT(NEW.json,'$.gw_addr'));
      INSERT INTO jsons_params (reference,date_packet,basestation) VALUES (NEW.reference,@dt,@bs);

      In this case, both @dt and @bs become NULL, which causes an error in our table for no accepting NULL in timestamps. If we take one of the variables out and substitute its value for a dummy during insert, everything goes ok. However two or more lead to both being NULL.

      A similar server, running 10.3.12, does not have these issues at all. Similar triggers run there without problems.

      This bug was also reported in a completely different server running the same version of MariaDB. Physically it is a completely different machine with completely different tasks. However the same case ocurred - inside a TRIGGER, two or more variables lead to trouble.

      No workarounds were found.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            ektanoor Pedro Rosa
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: