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

[Feature] Issue#61 new built-in function to let customer manually issue an error

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Won't Do
    • Fix Version/s: N/A
    • Component/s: OTHER
    • Labels:
      None

      Description

      A new built-in function RAISE_ERROR('diagnostic-string') is needed to
      let mysql users fail current statement with the desired
      diagnostic-string error message and reserved sql error code.
       
      DB2 does in its' RAISE_ERROR() function, where the function accepts
      parameters of sql state and msg, and Oracle's RAISE_APPLICATION_ERROR
      has similar function.
       
      In our implementation, raise_error() accepts parameter of msg and
      optional sql state, both are strings. NULL value input is not allowed
      for either one, and only validate sql state is allowed.
       
      Here are samples:
       
      --error ER_SP_BAD_SQLSTATE
       
      select raise_error(NULL, 'null sql state not allowed');
       
      --error ER_MALFORMED_MESSAGE select raise_error('70001', NULL);
       
      --error ER_SP_BAD_SQLSTATE
       
      select raise_error('00001', 'invalid sql state');
       
      --error ER_SP_BAD_SQLSTATE
       
      select raise_error('666666', 'length of sql state exceeds 5');
       
      --error ER_INTENTIONAL_ERROR
       
      select raise_error('70001', 'this is a sample error msg');
       
      --error ER_INTENTIONAL_ERROR
       
      select raise_error('this is a sample error msg');
       
      --error ER_INTENTIONAL_ERROR
      select raise_error('only error message applied');
      

      https://github.com/alibaba/AliSQL/commit/66c68db51483d6c719e13ab6a5dfdcb04ae22333

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            anel Anel Husakovic
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: