10.39. SHOW CREATE FUNCTION

Synopsis

  1. SHOW CREATE FUNCTION function_name [ ( parameter_type[, ...] ) ]

Description

Show the SQL statement that creates the specified function if the optional list of parameter types is specified.

If parameter type list is omitted, show one row for each signature with the given function_name.

Examples

Show the SQL statement that can be run to create the example.default.array_sum(ARRAY<BIGINT>) function:

  1. SHOW CREATE FUNCTION example.default.array_sum(ARRAY<BIGINT>)
  1. Create Function | Argument Types
  2. ------------------------------------------------------------------------------------------------------+----------------
  3. CREATE FUNCTION example.default.array_sum ( | ARRAY(bigint)
  4. input ARRAY(bigint) |
  5. ) |
  6. RETURNS bigint |
  7. COMMENT 'Calculate sum of all array elements. Nulls elements are ignored. Returns 0 on empty array.' |
  8. LANGUAGE SQL |
  9. DETERMINISTIC |
  10. RETURNS NULL ON NULL INPUT |
  11. RETURN "reduce"(input, 0, (s, x) -> (s + COALESCE(x, 0)), (s) -> s) |
  12. (1 row)

Show all SQL statements that can be run to create the example.default.array_sum functions:

  1. SHOW CREATE FUNCTION example.default.array_sum
  1. Create Function | Argument Types
  2. ------------------------------------------------------------------------------------------------------+----------------
  3. CREATE FUNCTION example.default.array_sum ( +| ARRAY(bigint)
  4. input ARRAY(bigint) +|
  5. ) +|
  6. RETURNS bigint +|
  7. COMMENT 'Calculate sum of all array elements. Nulls elements are ignored. Returns 0 on empty array.'+|
  8. LANGUAGE SQL +|
  9. DETERMINISTIC +|
  10. RETURNS NULL ON NULL INPUT +|
  11. RETURN "reduce"(input, 0, (s, x) -> (s + COALESCE(x, 0)), (s) -> s) |
  12. CREATE FUNCTION example.default.array_sum ( +| ARRAY(double)
  13. input ARRAY(double) +|
  14. ) +|
  15. RETURNS double +|
  16. COMMENT 'Calculate sum of all array elements. Nulls elements are ignored. Returns 0 on empty array.'+|
  17. LANGUAGE SQL +|
  18. DETERMINISTIC +|
  19. RETURNS NULL ON NULL INPUT +|
  20. RETURN "reduce"(input, double '0.0', (s, x) -> (s + COALESCE(x, double '0.0')), (s) -> s) |
  21. (2 rows)

See Also

CREATE FUNCTION