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

stored procedure input parameter specified as an INT rounds when a DOUBLE is input by the caller

    XMLWordPrintable

Details

    Description

      If i create a stored procedure with an input parameter specified as an INT, I expect the procedure to fail when a non-INT value is provided in a call.

      Instead, if a user calls a procedure thus:

      call my_db.my_sproc(5.47);
      

      mariadb rounds 5.47 to 5.

      I expect the stored procedure to throw an error. If the input procedure is VARCHAR(10) and the user inputs a VARCHAR(20) the procedure throws an error. It does not truncate the input parameter to 10 characters and silently move on.

      Worse, I don't even have the opportunity to intercept the input variable and check it. By the time it is available in the body of the stored procedure it is already rounded to an INT.

      The work around that I can do is specify the input parameter as a DOUBLE and then it is not rounded. I can then access it in the body of the stored procedure and see if it is actually an int or not. However this is not ideal. We have many stored procedures with input parameters specified as INTs.

      I thought perhaps there would be a way to determine the treatment of INTs in sql_mode or some other setting, but was unable to find anything.

      Thanks,
      Kevin

      Attachments

        Activity

          People

            Unassigned Unassigned
            kevinoh@uw.edu James Kevin O'Halloran
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.