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

Giving an alias to function argument (now can make the query to fail)

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The query, calling a UDF:

      select Json_Object(5 as "five", 7 as "seven");
      

      works fine; however, this one:

      select greatest(5 as "five", 7 as "seven");
      

      fails saying: "Incorrect parameters in the call to native function "greatest".

      Indeed, in this case, aliases are useless but why flag this as an error? Perhaps a warning saying that these aliases are ignored would be acceptable.

      BTW: The MariaDB documentation on aliases (in the tutorial) does not say anything about aliasing function arguments. This is an important feature for UDF's as it correspond to the attribute of arguments.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            I created a subtask (MDEV-8822) for the documentation shortage.

            Aliases for function arguments is a feature request, so the issue has been switched from Bug to Task.
            Looking at the SQL standard, I am not sure it should be implemented. If I read it right, it says that a function call can indeed have AS ... clause, but it would be AS UDT type rather than AS alias.
            Not having UDT types in the current implementation is one thing, but using the syntax for something different is another.
            However, I'm never sure I understand the standard correctly, so I'll keep it open till Sergei Golubchik says his word.

            Show
            elenst Elena Stepanova added a comment - I created a subtask ( MDEV-8822 ) for the documentation shortage. Aliases for function arguments is a feature request, so the issue has been switched from Bug to Task. Looking at the SQL standard , I am not sure it should be implemented. If I read it right, it says that a function call can indeed have AS ... clause, but it would be AS UDT type rather than AS alias . Not having UDT types in the current implementation is one thing, but using the syntax for something different is another. However, I'm never sure I understand the standard correctly, so I'll keep it open till Sergei Golubchik says his word.

              People

              • Assignee:
                Unassigned
                Reporter:
                bertrandop Olivier Bertrand
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: