Chapter 7. Automating processes

Table of Contents
Enabling plpgsql
Recording a log of changes to a table
Updating a "last changed" field

Enabling plpgsql

You want to write functions and build triggers in Postgres' scripting language plpgsql.

Solution

As superuser (postgres) use the command-line tool createlang ref.

So to activate plpgsql in database db1 use:

createlang plpgsql db1