Functions Wizard (PostgreSQL)

From DBArtisan
Jump to: navigation, search

Go Up to PostgreSQL Object Wizards

This wizard lets you build and submit a CREATE OR REPLACE FUNCTION statement, creating a new function or replacing an existing function.

Note: Before working with this object action, consult PostreSQL documentation for details on CREATE FUNCTION parameter values. For more information, see Accessing Third Party Documentation.

To create a new function using a wizard:

  1. Open a creation wizard for a function. For details, see Opening an Object Wizard.
  2. Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
  3. Finally, use the Execute button to create the object.

Functions (PostgreSQL) - Properties

When creating or editing a domain, this tab/panel lets you work with the following settings:

Setting Description

Schema and Name

Let you identify the owning schema and provide a name for the function.

Return Type

Lets you provide a RETURNS clause value, specifying a valid type (base, composite, domain type, or a reference to the type of a table column) for the value returned by the function.

Language

Lets you provide a LANGUAGE clause value, specifying a valid language implementation.

Object File and Link Symbol

Let you specify the AS clause appropriate to dynamically loadable C language functions for which the function name in the C language source code is identical to the name of the SQL function. Object File is the name of the file containing the dynamically loadable object. Link Symbol is the function name in the C language source code.

Is Window

If selected, specifies that this C language function is a window function.

Leakproof

If selected, a LEAKPROOF clause is added to the generated DDL, indicating that the function provides no information about its arguments other than by its return value.

Execution Cost

Lets you provide a COST clause value, estimating the execution cost in CPU operator cost units.

Result Rows

Lets you provide a ROWS clause value, estimating the number of rows the function is expected to return.

Behavior

Lets you select an IMMUTABLE, STABLE, or VOLATILE clause to the generated DDL, indicating the functions behavior with respect to database lookups and ability to make changes to the database.

Strict

Lets you add a STRICT clause to the generated DDL, specifying whether non-NULL values can be returned if any provided input parameters are NULL.

Is Security Definer

Lets you add a SECURITY DEFINED clause to the generated DDL, specifying that the function is to execute with the same privileges as the user who created it.

Functions (PostgreSQL) - Parameters

When creating or editing a function, this tab/panel lets you build and maintain a list of input/output parameters for the function. For each input or output parameter for this function, use the New button to add a new parameter and then provide a name for the parameter.

To edit a parameter in the attributes list, first select the parameter in the list. Then, in the Attributes area, select a Datatype, select a Parameter Mode (INPUT, OUTPUT, INPUT_OUTPUT, or VARIADIC), and if you chose INPUT, you can optionally provide a Default value.

To delete a parameter from the list, select the parameter and click the Delete button.

To reposition a parameter in the list, select the parameter and use the arrow buttons to move the parameter up or down in the list.

Functions (PostgreSQL) - Body

When creating or editing a function, this tab/panel lets you build and maintain a valid AS clause value that defines the function. You can use an internal function name, the path to an object file, a SQL query, or text in a procedural language.