SHOW CREATE FUNCTION

Function

Returns the exact string that can be used to recreate the named function. A similar statement SHOW CREATE PROCEDURE displays information about storage functions. To use either statement, you must have the global SELECT permission.

Precautions

The sql_mode indicates the session value during query. Database b displays the sql_mode bound during routine creation. openGauss displays the session value because openGauss does not bind routines to sql_mode during routine creation.

character_set_client is the session value of the system variable when client_encoding creates the routine.

collation_connection is the value specified when lc_collate creates the database.

Database Collation is the value specified when lc_collate creates the database.

Syntax

SHOW CREATE FUNCTION func_name

Parameter Description

  • func_name

    Name of the function.

Examples

--Create a function.
openGauss=# CREATE FUNCTION functest_A_1(text, date) RETURNS bool LANGUAGE 'sql'
       AS 'SELECT $1 = ''abcd'' AND $2 > ''2001-01-01''';
CREATE FUNCTION
--Query a statement for creating a function.
openGauss=# show create function functest_A_1;
   Function   |                         Create Function                          |              sql_mode               | character_set_client | collation_connection 
| Database Collation 
--------------+------------------------------------------------------------------+-------------------------------------+----------------------+----------------------+--------------------
 functest_a_1 | CREATE OR REPLACE FUNCTION public.functest_a_1(text, date)      +| sql_mode_strict,sql_mode_full_group | UTF8                 | en_US.UTF-8          
| en_US.UTF-8
              |  RETURNS boolean                                                +|                                     |                      |                      
| 
              |  LANGUAGE sql                                                   +|                                     |                      |                      
| 
              |  NOT FENCED NOT SHIPPABLE                                       +|                                     |                      |                      
| 
              | AS $function$SELECT $1 = 'abcd' AND $2 > '2001-01-01'$function$;+|                                     |                      |                      
| 
              |                                                                  |                                     |                      |                      
| 
(1 row)
Feedback
编组 3备份
    openGauss 2024-05-19 00:42:09
    cancel