1. Packages
  2. Postgresql Provider
  3. API Docs
  4. Function
PostgreSQL v3.15.1 published on Saturday, Mar 15, 2025 by Pulumi

postgresql.Function

Explore with Pulumi AI

The postgresql.Function resource creates and manages a function on a PostgreSQL server.

Usage

import * as pulumi from "@pulumi/pulumi";
import * as postgresql from "@pulumi/postgresql";

const increment = new postgresql.Function("increment", {
    name: "increment",
    args: [{
        name: "i",
        type: "integer",
    }],
    returns: "integer",
    language: "plpgsql",
    body: `BEGIN
    RETURN i + 1;
END;
`,
});
Copy
import pulumi
import pulumi_postgresql as postgresql

increment = postgresql.Function("increment",
    name="increment",
    args=[{
        "name": "i",
        "type": "integer",
    }],
    returns="integer",
    language="plpgsql",
    body="""BEGIN
    RETURN i + 1;
END;
""")
Copy
package main

import (
	"github.com/pulumi/pulumi-postgresql/sdk/v3/go/postgresql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := postgresql.NewFunction(ctx, "increment", &postgresql.FunctionArgs{
			Name: pulumi.String("increment"),
			Args: postgresql.FunctionArgArray{
				&postgresql.FunctionArgArgs{
					Name: pulumi.String("i"),
					Type: pulumi.String("integer"),
				},
			},
			Returns:  pulumi.String("integer"),
			Language: pulumi.String("plpgsql"),
			Body:     pulumi.String("BEGIN\n    RETURN i + 1;\nEND;\n"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using PostgreSql = Pulumi.PostgreSql;

return await Deployment.RunAsync(() => 
{
    var increment = new PostgreSql.Function("increment", new()
    {
        Name = "increment",
        Args = new[]
        {
            new PostgreSql.Inputs.FunctionArgArgs
            {
                Name = "i",
                Type = "integer",
            },
        },
        Returns = "integer",
        Language = "plpgsql",
        Body = @"BEGIN
    RETURN i + 1;
END;
",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.postgresql.Function;
import com.pulumi.postgresql.FunctionArgs;
import com.pulumi.postgresql.inputs.FunctionArgArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var increment = new Function("increment", FunctionArgs.builder()
            .name("increment")
            .args(FunctionArgArgs.builder()
                .name("i")
                .type("integer")
                .build())
            .returns("integer")
            .language("plpgsql")
            .body("""
BEGIN
    RETURN i + 1;
END;
            """)
            .build());

    }
}
Copy
resources:
  increment:
    type: postgresql:Function
    properties:
      name: increment
      args:
        - name: i
          type: integer
      returns: integer
      language: plpgsql
      body: |
        BEGIN
            RETURN i + 1;
        END;        
Copy

Create Function Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);
@overload
def Function(resource_name: str,
             args: FunctionArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def Function(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             body: Optional[str] = None,
             args: Optional[Sequence[FunctionArgArgs]] = None,
             database: Optional[str] = None,
             drop_cascade: Optional[bool] = None,
             language: Optional[str] = None,
             name: Optional[str] = None,
             parallel: Optional[str] = None,
             returns: Optional[str] = None,
             schema: Optional[str] = None,
             security_definer: Optional[bool] = None,
             strict: Optional[bool] = None,
             volatility: Optional[str] = None)
func NewFunction(ctx *Context, name string, args FunctionArgs, opts ...ResourceOption) (*Function, error)
public Function(string name, FunctionArgs args, CustomResourceOptions? opts = null)
public Function(String name, FunctionArgs args)
public Function(String name, FunctionArgs args, CustomResourceOptions options)
type: postgresql:Function
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. FunctionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. FunctionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. FunctionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. FunctionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. FunctionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var functionResource = new PostgreSql.Function("functionResource", new()
{
    Body = "string",
    Args = new[]
    {
        new PostgreSql.Inputs.FunctionArgArgs
        {
            Type = "string",
            Default = "string",
            Mode = "string",
            Name = "string",
        },
    },
    Database = "string",
    DropCascade = false,
    Language = "string",
    Name = "string",
    Parallel = "string",
    Returns = "string",
    Schema = "string",
    SecurityDefiner = false,
    Strict = false,
    Volatility = "string",
});
Copy
example, err := postgresql.NewFunction(ctx, "functionResource", &postgresql.FunctionArgs{
	Body: pulumi.String("string"),
	Args: postgresql.FunctionArgArray{
		&postgresql.FunctionArgArgs{
			Type:    pulumi.String("string"),
			Default: pulumi.String("string"),
			Mode:    pulumi.String("string"),
			Name:    pulumi.String("string"),
		},
	},
	Database:        pulumi.String("string"),
	DropCascade:     pulumi.Bool(false),
	Language:        pulumi.String("string"),
	Name:            pulumi.String("string"),
	Parallel:        pulumi.String("string"),
	Returns:         pulumi.String("string"),
	Schema:          pulumi.String("string"),
	SecurityDefiner: pulumi.Bool(false),
	Strict:          pulumi.Bool(false),
	Volatility:      pulumi.String("string"),
})
Copy
var functionResource = new Function("functionResource", FunctionArgs.builder()
    .body("string")
    .args(FunctionArgArgs.builder()
        .type("string")
        .default_("string")
        .mode("string")
        .name("string")
        .build())
    .database("string")
    .dropCascade(false)
    .language("string")
    .name("string")
    .parallel("string")
    .returns("string")
    .schema("string")
    .securityDefiner(false)
    .strict(false)
    .volatility("string")
    .build());
Copy
function_resource = postgresql.Function("functionResource",
    body="string",
    args=[{
        "type": "string",
        "default": "string",
        "mode": "string",
        "name": "string",
    }],
    database="string",
    drop_cascade=False,
    language="string",
    name="string",
    parallel="string",
    returns="string",
    schema="string",
    security_definer=False,
    strict=False,
    volatility="string")
Copy
const functionResource = new postgresql.Function("functionResource", {
    body: "string",
    args: [{
        type: "string",
        "default": "string",
        mode: "string",
        name: "string",
    }],
    database: "string",
    dropCascade: false,
    language: "string",
    name: "string",
    parallel: "string",
    returns: "string",
    schema: "string",
    securityDefiner: false,
    strict: false,
    volatility: "string",
});
Copy
type: postgresql:Function
properties:
    args:
        - default: string
          mode: string
          name: string
          type: string
    body: string
    database: string
    dropCascade: false
    language: string
    name: string
    parallel: string
    returns: string
    schema: string
    securityDefiner: false
    strict: false
    volatility: string
Copy

Function Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Function resource accepts the following input properties:

Body This property is required. string
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
Args Changes to this property will trigger replacement. List<Pulumi.PostgreSql.Inputs.FunctionArg>
List of arguments for the function.
Database Changes to this property will trigger replacement. string
The database where the function is located. If not specified, the function is created in the current database.
DropCascade bool
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
Language Changes to this property will trigger replacement. string
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
Name Changes to this property will trigger replacement. string
The name of the function.
Parallel string
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
Returns Changes to this property will trigger replacement. string
Type that the function returns. It can be computed from the OUT arguments. Default is void.
Schema Changes to this property will trigger replacement. string
The schema where the function is located. If not specified, the function is created in the current schema.
SecurityDefiner bool
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
Strict bool
If the function should always return NULL when any of the inputs is NULL. Default is false.
Volatility string
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
Body This property is required. string
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
Args Changes to this property will trigger replacement. []FunctionArgArgs
List of arguments for the function.
Database Changes to this property will trigger replacement. string
The database where the function is located. If not specified, the function is created in the current database.
DropCascade bool
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
Language Changes to this property will trigger replacement. string
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
Name Changes to this property will trigger replacement. string
The name of the function.
Parallel string
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
Returns Changes to this property will trigger replacement. string
Type that the function returns. It can be computed from the OUT arguments. Default is void.
Schema Changes to this property will trigger replacement. string
The schema where the function is located. If not specified, the function is created in the current schema.
SecurityDefiner bool
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
Strict bool
If the function should always return NULL when any of the inputs is NULL. Default is false.
Volatility string
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
body This property is required. String
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
args Changes to this property will trigger replacement. List<FunctionArg>
List of arguments for the function.
database Changes to this property will trigger replacement. String
The database where the function is located. If not specified, the function is created in the current database.
dropCascade Boolean
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
language Changes to this property will trigger replacement. String
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
name Changes to this property will trigger replacement. String
The name of the function.
parallel String
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
returns Changes to this property will trigger replacement. String
Type that the function returns. It can be computed from the OUT arguments. Default is void.
schema Changes to this property will trigger replacement. String
The schema where the function is located. If not specified, the function is created in the current schema.
securityDefiner Boolean
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
strict Boolean
If the function should always return NULL when any of the inputs is NULL. Default is false.
volatility String
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
body This property is required. string
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
args Changes to this property will trigger replacement. FunctionArg[]
List of arguments for the function.
database Changes to this property will trigger replacement. string
The database where the function is located. If not specified, the function is created in the current database.
dropCascade boolean
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
language Changes to this property will trigger replacement. string
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
name Changes to this property will trigger replacement. string
The name of the function.
parallel string
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
returns Changes to this property will trigger replacement. string
Type that the function returns. It can be computed from the OUT arguments. Default is void.
schema Changes to this property will trigger replacement. string
The schema where the function is located. If not specified, the function is created in the current schema.
securityDefiner boolean
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
strict boolean
If the function should always return NULL when any of the inputs is NULL. Default is false.
volatility string
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
body This property is required. str
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
args Changes to this property will trigger replacement. Sequence[FunctionArgArgs]
List of arguments for the function.
database Changes to this property will trigger replacement. str
The database where the function is located. If not specified, the function is created in the current database.
drop_cascade bool
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
language Changes to this property will trigger replacement. str
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
name Changes to this property will trigger replacement. str
The name of the function.
parallel str
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
returns Changes to this property will trigger replacement. str
Type that the function returns. It can be computed from the OUT arguments. Default is void.
schema Changes to this property will trigger replacement. str
The schema where the function is located. If not specified, the function is created in the current schema.
security_definer bool
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
strict bool
If the function should always return NULL when any of the inputs is NULL. Default is false.
volatility str
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
body This property is required. String
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
args Changes to this property will trigger replacement. List<Property Map>
List of arguments for the function.
database Changes to this property will trigger replacement. String
The database where the function is located. If not specified, the function is created in the current database.
dropCascade Boolean
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
language Changes to this property will trigger replacement. String
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
name Changes to this property will trigger replacement. String
The name of the function.
parallel String
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
returns Changes to this property will trigger replacement. String
Type that the function returns. It can be computed from the OUT arguments. Default is void.
schema Changes to this property will trigger replacement. String
The schema where the function is located. If not specified, the function is created in the current schema.
securityDefiner Boolean
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
strict Boolean
If the function should always return NULL when any of the inputs is NULL. Default is false.
volatility String
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.

Outputs

All input properties are implicitly available as output properties. Additionally, the Function resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Function Resource

Get an existing Function resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FunctionState, opts?: CustomResourceOptions): Function
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        args: Optional[Sequence[FunctionArgArgs]] = None,
        body: Optional[str] = None,
        database: Optional[str] = None,
        drop_cascade: Optional[bool] = None,
        language: Optional[str] = None,
        name: Optional[str] = None,
        parallel: Optional[str] = None,
        returns: Optional[str] = None,
        schema: Optional[str] = None,
        security_definer: Optional[bool] = None,
        strict: Optional[bool] = None,
        volatility: Optional[str] = None) -> Function
func GetFunction(ctx *Context, name string, id IDInput, state *FunctionState, opts ...ResourceOption) (*Function, error)
public static Function Get(string name, Input<string> id, FunctionState? state, CustomResourceOptions? opts = null)
public static Function get(String name, Output<String> id, FunctionState state, CustomResourceOptions options)
resources:  _:    type: postgresql:Function    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Args Changes to this property will trigger replacement. List<Pulumi.PostgreSql.Inputs.FunctionArg>
List of arguments for the function.
Body string
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
Database Changes to this property will trigger replacement. string
The database where the function is located. If not specified, the function is created in the current database.
DropCascade bool
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
Language Changes to this property will trigger replacement. string
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
Name Changes to this property will trigger replacement. string
The name of the function.
Parallel string
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
Returns Changes to this property will trigger replacement. string
Type that the function returns. It can be computed from the OUT arguments. Default is void.
Schema Changes to this property will trigger replacement. string
The schema where the function is located. If not specified, the function is created in the current schema.
SecurityDefiner bool
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
Strict bool
If the function should always return NULL when any of the inputs is NULL. Default is false.
Volatility string
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
Args Changes to this property will trigger replacement. []FunctionArgArgs
List of arguments for the function.
Body string
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
Database Changes to this property will trigger replacement. string
The database where the function is located. If not specified, the function is created in the current database.
DropCascade bool
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
Language Changes to this property will trigger replacement. string
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
Name Changes to this property will trigger replacement. string
The name of the function.
Parallel string
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
Returns Changes to this property will trigger replacement. string
Type that the function returns. It can be computed from the OUT arguments. Default is void.
Schema Changes to this property will trigger replacement. string
The schema where the function is located. If not specified, the function is created in the current schema.
SecurityDefiner bool
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
Strict bool
If the function should always return NULL when any of the inputs is NULL. Default is false.
Volatility string
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
args Changes to this property will trigger replacement. List<FunctionArg>
List of arguments for the function.
body String
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
database Changes to this property will trigger replacement. String
The database where the function is located. If not specified, the function is created in the current database.
dropCascade Boolean
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
language Changes to this property will trigger replacement. String
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
name Changes to this property will trigger replacement. String
The name of the function.
parallel String
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
returns Changes to this property will trigger replacement. String
Type that the function returns. It can be computed from the OUT arguments. Default is void.
schema Changes to this property will trigger replacement. String
The schema where the function is located. If not specified, the function is created in the current schema.
securityDefiner Boolean
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
strict Boolean
If the function should always return NULL when any of the inputs is NULL. Default is false.
volatility String
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
args Changes to this property will trigger replacement. FunctionArg[]
List of arguments for the function.
body string
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
database Changes to this property will trigger replacement. string
The database where the function is located. If not specified, the function is created in the current database.
dropCascade boolean
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
language Changes to this property will trigger replacement. string
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
name Changes to this property will trigger replacement. string
The name of the function.
parallel string
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
returns Changes to this property will trigger replacement. string
Type that the function returns. It can be computed from the OUT arguments. Default is void.
schema Changes to this property will trigger replacement. string
The schema where the function is located. If not specified, the function is created in the current schema.
securityDefiner boolean
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
strict boolean
If the function should always return NULL when any of the inputs is NULL. Default is false.
volatility string
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
args Changes to this property will trigger replacement. Sequence[FunctionArgArgs]
List of arguments for the function.
body str
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
database Changes to this property will trigger replacement. str
The database where the function is located. If not specified, the function is created in the current database.
drop_cascade bool
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
language Changes to this property will trigger replacement. str
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
name Changes to this property will trigger replacement. str
The name of the function.
parallel str
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
returns Changes to this property will trigger replacement. str
Type that the function returns. It can be computed from the OUT arguments. Default is void.
schema Changes to this property will trigger replacement. str
The schema where the function is located. If not specified, the function is created in the current schema.
security_definer bool
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
strict bool
If the function should always return NULL when any of the inputs is NULL. Default is false.
volatility str
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.
args Changes to this property will trigger replacement. List<Property Map>
List of arguments for the function.
body String
Function body. This should be the body content within the AS $$ and the final $$. It will also accept the AS $$ and $$ if added.
database Changes to this property will trigger replacement. String
The database where the function is located. If not specified, the function is created in the current database.
dropCascade Boolean
True to automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects. Default is false.
language Changes to this property will trigger replacement. String
The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
name Changes to this property will trigger replacement. String
The name of the function.
parallel String
Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
returns Changes to this property will trigger replacement. String
Type that the function returns. It can be computed from the OUT arguments. Default is void.
schema Changes to this property will trigger replacement. String
The schema where the function is located. If not specified, the function is created in the current schema.
securityDefiner Boolean
If the function should execute with the permissions of the owner, rather than the permissions of the caller. Default is false.
strict Boolean
If the function should always return NULL when any of the inputs is NULL. Default is false.
volatility String
Defines the volatility of the function. Can be one of VOLATILE, STABLE, or IMMUTABLE. Default is VOLATILE.

Supporting Types

FunctionArg
, FunctionArgArgs

Type
This property is required.
Changes to this property will trigger replacement.
string
The type of the argument.
Default string
An expression to be used as default value if the parameter is not specified.
Mode Changes to this property will trigger replacement. string
Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
Name Changes to this property will trigger replacement. string
The name of the argument.
Type
This property is required.
Changes to this property will trigger replacement.
string
The type of the argument.
Default string
An expression to be used as default value if the parameter is not specified.
Mode Changes to this property will trigger replacement. string
Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
Name Changes to this property will trigger replacement. string
The name of the argument.
type
This property is required.
Changes to this property will trigger replacement.
String
The type of the argument.
default_ String
An expression to be used as default value if the parameter is not specified.
mode Changes to this property will trigger replacement. String
Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
name Changes to this property will trigger replacement. String
The name of the argument.
type
This property is required.
Changes to this property will trigger replacement.
string
The type of the argument.
default string
An expression to be used as default value if the parameter is not specified.
mode Changes to this property will trigger replacement. string
Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
name Changes to this property will trigger replacement. string
The name of the argument.
type
This property is required.
Changes to this property will trigger replacement.
str
The type of the argument.
default str
An expression to be used as default value if the parameter is not specified.
mode Changes to this property will trigger replacement. str
Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
name Changes to this property will trigger replacement. str
The name of the argument.
type
This property is required.
Changes to this property will trigger replacement.
String
The type of the argument.
default String
An expression to be used as default value if the parameter is not specified.
mode Changes to this property will trigger replacement. String
Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
name Changes to this property will trigger replacement. String
The name of the argument.

Import

It is possible to import a postgresql_function resource with the following command:

$ pulumi import postgresql:index/function:Function function_foo "my_database.my_schema.my_function_name(arguments)"
Copy

Where my_database is the name of the database containing the schema, my_schema is the name of the schema in the PostgreSQL database, my_function_name is the function name to be imported, arguments is the argument signature of the function including all non OUT types and postgresql_schema.function_foo is the name of the resource whose state will be populated as a result of the command.

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
PostgreSQL pulumi/pulumi-postgresql
License
Apache-2.0
Notes
This Pulumi package is based on the postgresql Terraform Provider.