Support SHOW CREATE FUNCTION
See original GitHub issueCurrently, user do not have the ability to see the definition of the SQL functions after they created them. Similar to SHOW CREATE TABLE
and SHOW CREATE VIEW
, we should also support a similar (though not specified in SQL-standard) syntax for this functionality.
Syntax
For SHOW CREATE TABLE/VIEW
, given a fully-qualified name of a table/view, the object is always unique. However, this is not the case for SHOW CREATE FUNCTION
as there might be multiple signatures for the same name.
Hence, I’m proposing the following syntax. This is similar to DROP FUNCTION
and ALTER FUNCTION
where an optional data type list is allowed.
<show create function statement> ::=
SHOW CREATE <specific routine designator>
<specific routine designator> ::=
<routine type> <member name>
<routine type> ::=
FUNCTION
<member name> ::=
<member name alternatives> [ <data type list> ]
<member name alternatives> ::=
<schema qualified routine name>
<data type list> ::=
<left paren> [ <data type> [ { <comma> <data type> }... ] ] <right paren>
Behavior
A SHOW CREATE FUNCTION
query outputs one column “Create Function”, the formatted SQL text that would create the exact same function, for each signature that matches what the query specifies.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
@rongrong I cannot find any
SHOW CREATE
statements being part of SQL-standard, so I believe they’re not.The parameter list is optional in case user want’s to show a function with the specific signature (for example, might be useful in some automated scripts / pipelines). That being said,
SHOW CREATE FUNCTION function_name
is a perfectly valid query.Addressed by https://github.com/prestodb/presto/pull/14366