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

Inconsistency between CREATE FUNCTION SYSDATE and DROP FUNCTION SYSDATE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
    • Fix Version/s: 10.4
    • Component/s: Parser
    • Labels:

      Description

      This query:

      DROP FUNCTION IF EXISTS SYSDATE;
      

      works normally and returns no errors.

      This query:

      CREATE FUNCTION SYSDATE() RETURNS INT RETURN 10;
      

      returns an error:

      ERROR 1064 (42000): You have an error in your SQL syntax ... near 'SYSDATE() ...
      

      There is an inconsistency in here.
      Either both queries should return an error, or both work with no errors.

      The best solution is to make both queries work, as we generally allow to create stored functions that have the same names with built-in functions:

      DROP FUNCTION IF EXISTS CONCAT;
      CREATE FUNCTION CONCAT(a TEXT) RETURNS TEXT RETURN 'test';
      SELECT test.CONCAT('dummy');
      DROP FUNCTION CONCAT;
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:

                  Git Integration