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

sql_mode=ORACLE: INET6 does not work as a routine parameter type and return type

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.5
    • 10.5.0
    • Parser
    • None

    Description

      The below CREATE FUNCTION statements understand INET6 in both parameter list and in the RETURNS clause

      SET sql_mode='';
      CREATE OR REPLACE FUNCTION f1() RETURNS INET6 RETURN NULL;
      CREATE OR REPLACE FUNCTION f1(a INET6) RETURNS INT RETURN NULL;
      

      Equivalent CREATE FUNCTION statements in sql_mode=ORACLE return a syntax error:

      SET sql_mode=ORACLE;
      DELIMITER $$
      CREATE OR REPLACE FUNCTION f1() RETURN INET6 AS
      BEGIN
        RETURN NULL;
      END;
      $$
      DELIMITER ;
      

      ERROR 1064 (42000): You have an error in your SQL syntax ... near 'INET6 AS
      BEGIN
        RETURN NULL;
      END' at line 1
      

      SET sql_mode=ORACLE;
      DELIMITER $$
      CREATE OR REPLACE FUNCTION f1(a INET6) RETURN INT AS
      BEGIN
        RETURN NULL;
      END;
      $$
      DELIMITER ;
      

      ERROR 1064 (42000): You have an error in your SQL syntax ... near ') RETURN INT AS
      BEGIN
        RETURN NULL;
      END' at line 1
      

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            Summary sql_mode=ORACLE: INET6 does not work as an routine parameter type and return type sql_mode=ORACLE: INET6 does not work as a routine parameter type and return type
            bar Alexander Barkov made changes -
            Description The below CREATE FUNCTION statements understand INET6 in both parameter list and in the RETURNS clause
            {code:sql}
            SET sql_mode='';
            CREATE OR REPLACE FUNCTION f1() RETURNS INET6 RETURN NULL;
            CREATE OR REPLACE FUNCTION f1(a INET6) RETURNS INT RETURN NULL;
            {code}

            Equivalent function in sql_mode=ORACLE return a syntax error:
            {code:sql}
            SET sql_mode=ORACLE;
            DELIMITER $$
            CREATE OR REPLACE FUNCTION f1() RETURN INET6 AS
            BEGIN
              RETURN NULL;
            END;
            $$
            DELIMITER ;
            {code}
            {noformat}
            ERROR 1064 (42000): You have an error in your SQL syntax ... near 'INET6 AS
            BEGIN
              RETURN NULL;
            END' at line 1
            {noformat}


            {code:sql}
            SET sql_mode=ORACLE;
            DELIMITER $$
            CREATE OR REPLACE FUNCTION f1(a INET6) RETURN INT AS
            BEGIN
              RETURN NULL;
            END;
            $$
            DELIMITER ;
            {code}
            {noformat}
            ERROR 1064 (42000): You have an error in your SQL syntax ... near ') RETURN INT AS
            BEGIN
              RETURN NULL;
            END' at line 1
            {noformat}
            The below CREATE FUNCTION statements understand INET6 in both parameter list and in the RETURNS clause
            {code:sql}
            SET sql_mode='';
            CREATE OR REPLACE FUNCTION f1() RETURNS INET6 RETURN NULL;
            CREATE OR REPLACE FUNCTION f1(a INET6) RETURNS INT RETURN NULL;
            {code}

            Equivalent CREATE FUNCTION statements in sql_mode=ORACLE return a syntax error:
            {code:sql}
            SET sql_mode=ORACLE;
            DELIMITER $$
            CREATE OR REPLACE FUNCTION f1() RETURN INET6 AS
            BEGIN
              RETURN NULL;
            END;
            $$
            DELIMITER ;
            {code}
            {noformat}
            ERROR 1064 (42000): You have an error in your SQL syntax ... near 'INET6 AS
            BEGIN
              RETURN NULL;
            END' at line 1
            {noformat}


            {code:sql}
            SET sql_mode=ORACLE;
            DELIMITER $$
            CREATE OR REPLACE FUNCTION f1(a INET6) RETURN INT AS
            BEGIN
              RETURN NULL;
            END;
            $$
            DELIMITER ;
            {code}
            {noformat}
            ERROR 1064 (42000): You have an error in your SQL syntax ... near ') RETURN INT AS
            BEGIN
              RETURN NULL;
            END' at line 1
            {noformat}
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            issue.field.resolutiondate 2019-10-29 09:34:32.0 2019-10-29 09:34:32.985
            bar Alexander Barkov made changes -
            Fix Version/s 10.5.0 [ 23709 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 100648 ] MariaDB v4 [ 156908 ]

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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