Skip to content

Installation

Requirements

  • pg_relay_notifier already installed in the target database — either via CREATE EXTENSION or the managed-PostgreSQL path.
  • Superuser access for the install itself (or the equivalent admin role on a managed service).

Installing (self-managed PostgreSQL)

The extension files install alongside pg_relay_notifier's own — the same make install covers both:

sudo make install          # installs both pg_relay_notifier and pg_relay_notifier_utl_mail files
CREATE EXTENSION pg_relay_notifier_utl_mail;

The control file declares requires = 'pg_relay_notifier', so PostgreSQL's own extension-dependency mechanism refuses the install with a clear error if pg_relay_notifier isn't present as a real, registered extension. A second, manual check inside the install script covers the case that check can't: pg_relay_notifier installed via the managed path (no CREATE EXTENSION, so no pg_extension row for the dependency check to find) — the install script verifies pgrelay_notifier.send_mail(...) actually exists and raises its own clear error if not.

Installing on managed PostgreSQL

Same mechanism as pg_relay_notifier itself — see Cloud Setup for the general explanation. Generate and run the managed script:

make managed
# → install/pg_relay_notifier_utl_mail--managed--1.0.sql
psql "$YOUR_DB_URL" -v ON_ERROR_STOP=1 -f install/pg_relay_notifier_utl_mail--managed--1.0.sql

pg_relay_notifier (managed or CREATE EXTENSION) must already be installed in the same database.

Verify

SELECT to_regprocedure('utl_mail.send(text,text,text,text,text,text,text,integer,text)') IS NOT NULL;
SELECT latest_version FROM pgrelay.list_applications()
WHERE lower(application_name) = 'pg_relay_notifier_utl_mail';   -- 1.0.0

The extension registers itself in pg_relay's application registry purely for operator visibility — it implements no pg_relay interface function and the Processor's preflight never checks it (unlike pg_relay_notifier itself).

After installing: configure a default profile

UTL_MAIL has no argument for a connection endpoint at all — see Default Profile Resolution. At minimum:

SELECT pgrelay.set_option('pg_relay_notifier_utl_mail.default_profile', 'my_smtp_profile');

Without this (or the core extension's own pg_relay_notifier.default_profile fallback configured), every utl_mail.* call raises until one is set.

Uninstalling

DROP EXTENSION pg_relay_notifier_utl_mail;
DROP SCHEMA IF EXISTS utl_mail CASCADE;   -- the auto-created schema lingers, same as pg_relay_notifier's own
-- optional: deregister — DROP EXTENSION does not do this automatically
DELETE FROM pgrelay.pg_relay_applications WHERE lower(application_name) = 'pg_relay_notifier_utl_mail';