1. Packages
  2. PostgreSQL
  3. API Docs
  4. Function
PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi

postgresql.Function

Explore with Pulumi AI

postgresql logo
PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi

    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", {
        args: [{
            name: "i",
            type: "integer",
        }],
        body: `    BEGIN
            RETURN i + 1;
        END;
    
    `,
        language: "plpgsql",
        returns: "integer",
    });
    
    import pulumi
    import pulumi_postgresql as postgresql
    
    increment = postgresql.Function("increment",
        args=[postgresql.FunctionArgArgs(
            name="i",
            type="integer",
        )],
        body="""    BEGIN
            RETURN i + 1;
        END;
    
    """,
        language="plpgsql",
        returns="integer")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PostgreSql = Pulumi.PostgreSql;
    
    return await Deployment.RunAsync(() => 
    {
        var increment = new PostgreSql.Function("increment", new()
        {
            Args = new[]
            {
                new PostgreSql.Inputs.FunctionArgArgs
                {
                    Name = "i",
                    Type = "integer",
                },
            },
            Body = @"    BEGIN
            RETURN i + 1;
        END;
    
    ",
            Language = "plpgsql",
            Returns = "integer",
        });
    
    });
    
    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{
    			Args: postgresql.FunctionArgArray{
    				&postgresql.FunctionArgArgs{
    					Name: pulumi.String("i"),
    					Type: pulumi.String("integer"),
    				},
    			},
    			Body:     pulumi.String("    BEGIN\n        RETURN i + 1;\n    END;\n\n"),
    			Language: pulumi.String("plpgsql"),
    			Returns:  pulumi.String("integer"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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()        
                .args(FunctionArgArgs.builder()
                    .name("i")
                    .type("integer")
                    .build())
                .body("""
        BEGIN
            RETURN i + 1;
        END;
    
                """)
                .language("plpgsql")
                .returns("integer")
                .build());
    
        }
    }
    
    resources:
      increment:
        type: postgresql:Function
        properties:
          args:
            - name: i
              type: integer
          body: |2+
                BEGIN
                    RETURN i + 1;
                END;
    
          language: plpgsql
          returns: integer
    

    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 string
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    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",
    });
    
    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"),
    })
    
    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());
    
    function_resource = postgresql.Function("functionResource",
        body="string",
        args=[postgresql.FunctionArgArgs(
            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")
    
    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",
    });
    
    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
    

    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

    The Function resource accepts the following input properties:

    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.
    Args List<Pulumi.PostgreSql.Inputs.FunctionArg>
    List of arguments for the function.
    Database 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 string
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    Name string
    The name of the argument.
    Parallel string
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    Returns string
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    Schema 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 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 []FunctionArgArgs
    List of arguments for the function.
    Database 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 string
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    Name string
    The name of the argument.
    Parallel string
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    Returns string
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    Schema 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 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 List<FunctionArg>
    List of arguments for the function.
    database 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 String
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    name String
    The name of the argument.
    parallel String
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    returns String
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    schema 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 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 FunctionArg[]
    List of arguments for the function.
    database 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 string
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    name string
    The name of the argument.
    parallel string
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    returns string
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    schema 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 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 Sequence[FunctionArgArgs]
    List of arguments for the function.
    database 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 str
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    name str
    The name of the argument.
    parallel str
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    returns str
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    schema 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 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 List<Property Map>
    List of arguments for the function.
    database 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 String
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    name String
    The name of the argument.
    parallel String
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    returns String
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    schema 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)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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 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 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 string
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    Name string
    The name of the argument.
    Parallel string
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    Returns string
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    Schema 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 []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 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 string
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    Name string
    The name of the argument.
    Parallel string
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    Returns string
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    Schema 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 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 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 String
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    name String
    The name of the argument.
    parallel String
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    returns String
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    schema 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 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 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 string
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    name string
    The name of the argument.
    parallel string
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    returns string
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    schema 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 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 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 str
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    name str
    The name of the argument.
    parallel str
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    returns str
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    schema 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 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 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 String
    The function programming language. Can be one of internal, sql, c, plpgsql. Default is plpgsql.
    name String
    The name of the argument.
    parallel String
    Indicates if the function is parallel safe. Can be one of UNSAFE, RESTRICTED, or SAFE. Default is UNSAFE.
    returns String
    Type that the function returns. It can be computed from the OUT arguments. Default is void.
    schema 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 string
    The type of the argument.
    Default string
    An expression to be used as default value if the parameter is not specified.
    Mode string
    Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
    Name string
    The name of the argument.
    Type string
    The type of the argument.
    Default string
    An expression to be used as default value if the parameter is not specified.
    Mode string
    Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
    Name string
    The name of the argument.
    type String
    The type of the argument.
    default_ String
    An expression to be used as default value if the parameter is not specified.
    mode String
    Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
    name String
    The name of the argument.
    type string
    The type of the argument.
    default string
    An expression to be used as default value if the parameter is not specified.
    mode string
    Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
    name string
    The name of the argument.
    type str
    The type of the argument.
    default str
    An expression to be used as default value if the parameter is not specified.
    mode str
    Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
    name str
    The name of the argument.
    type String
    The type of the argument.
    default String
    An expression to be used as default value if the parameter is not specified.
    mode String
    Can be one of IN, INOUT, OUT, or VARIADIC. Default is IN.
    name 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)"
    

    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.
    postgresql logo
    PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi