Use the PostgreSQL Function Editor to define a function for a database or table in a PostgreSQL physical model.
Note: Although in the syntax of PostgreSQL function, the "External" option is available for Security of Definer property, this option is not available in the database. Hence, this option is also not available under Security of Definer property. Similarly, the CALLED ON NULL INPUT and RETURNS NULL ON NULL INPUT options too are unavailable on the PostgreSQL Function Editor.
To define a PostgreSQL function
An instance of Function is created.
The PostgreSQL Function Editor opens.
Note: Click New on the toolbar to create a function. Use the Enter filter text box to filter a very large list of functions to quickly locate the one that you want to define.
Specifies the name of the function. Set the name of the function in this field.
Generates SQL during forward engineering. Clear the check box if you do not want to generate SQL.
Specifies the schema for the function. Select a schema from the drop-down list or click New to create one.
Specifies the owner of the function. Select a role from the drop-down list or click New and create one.
Specifies the name of the language that the function is implemented in. It can be SQL, C, internal, or the name of a user-defined procedural language, for example plpgsql.
Indicates that the function is a window function rather than a plain function. This is currently only useful for functions written in C.
Informs the query optimizer about the behavior of the function. Select one of the following:
Indicates that the function cannot modify the database and always returns the same result when given the same argument values. That is, it does not do database lookups or otherwise use information not directly present in its argument list.
Indicates that the function cannot modify the database, and that within a single table scan it will consistently return the same result for the same argument values, but that its result could change across SQL statements.
Indicates that the function value can change even within a single table scan, so no optimizations can be made. Relatively few database functions are volatile in this sense; some examples are random(), currval(), timeofday().
Indicates that the function always returns null whenever any of its arguments are null. If this parameter is specified, the function is not executed when there are null arguments; instead a null result is assumed automatically.
Indicates that the function has no side effects. It reveals no information about its arguments other than by its return value.
Specifies a positive number giving the estimated execution cost for the function, in units of cpu_operator_cost. If the function returns a set, this is the cost per returned row. If the cost is not specified, 1 unit is assumed for C-language and internal functions, and 100 units for functions in all other languages.
Indicates that the function will return a set of items, rather than a single item.
Specifies a positive number giving the estimated number of rows that the planner should expect the function to return. This is only allowed when the function is declared to return a set. The default assumption is 1000 rows.
Specifies the privilege that is to be used to execute the function. Select one of the following:
Indicates that the function is to be executed with the privileges of the user that calls it. That is the default.
Specifies that the function is to be executed with the privileges of the user that created it.
Specifies the mode of execution of the function. Select one of the following:
Indicates that the function can not be executed in parallel mode. The presence of such a function in an SQL statement forces a serial execution plan. This is the default.
Indicates that the function can be executed in parallel mode, but the execution is restricted to parallel group leader.
Indicates that the function is safe to run in parallel mode without restriction.
Specifies the name of the file containing the dynamically loadable object for C language functions.
Specifies the function's link symbol, that is, the name of the function in the C language source code. If the link symbol is omitted, it is assumed to be the same as the name of the SQL function being defined.
Specifies the type of the function. Select one of the following:
Indicates that the default return type will be used and all the parameters will be emitted.
Specifies that the return definition of the function is a table, using this option will only emit IN parameters in the arguments.
Specifies that the defined function is a trigger function.
Specifies the return data type of the function.
Specify the referenced table.
Specifies the name of the parameter.
Specifies the return data type of the parameter.
Specifies the type of the parameter. Select one out of IN, OUT, IN OUT, and VARIADIC.
Specifies an expression to be used as default value if the parameter is not specified. The expression has to be coercible to the argument type of the parameter. Only input (including IN OUT) parameters can have a default value.
Specifies the name of the variable.
Specifies an expression to be used as the variable value.
The function is defined and the PostgreSQL Function Editor closes.
For more information, refer to PostgreSQL documentation.
Copyright © 2017 erwin Inc.
All rights reserved.
|
|