Resource Type: pg_function

Defined in:
lib/puppet/type/pg_function.rb
Providers:
simple

Overview

This resource allows you to manage SQL functions in the Postgres database.

pg_function { 'testuser.return_some_value( Integer)/db@instance':
  ensure  => 'present',
  source => '/tests/function.sql',
}

This puppet definition ensures that the function ‘testuser.return_some_value(Integer)` is available in the database and that its content matches the content defined in the specified source.

To decide if the function needs an update, the puppet type compares the content in the database, with the content in the source file. This comparison is done insenitive to case, white spacing and used quote’s (the “ or the ‘ ).

To ensure detection of differences, your ‘content` of `source`needs to have the definition in the same order that the function `pg_get_functiondef` uses.

When you have specified ‘report_errors => true` (which is the default), the type will fail on SQL compilation errors.

Properties

  • ensure (defaults to: present)

    The basic property that the resource should be in.

    Supported values:
    • present
    • absent

Parameters

  • provider

    The specific backend to use for this ‘pg_function` resource. You will seldom need to specify this — Puppet will usually discover the appropriate provider for your platform.