pluginagentmarketplace/custom-plugin-postgresql · Archived

postgresql-plpgsql

Write PL/pgSQL - functions, procedures, triggers, error handling

First seen Feb 10, 2026

Installation

$ npx skills add pluginagentmarketplace/custom-plugin-postgresql --skill postgresql-plpgsql

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from pluginagentmarketplace/custom-plugin-postgresql · top by installs.

npx skills add pluginagentmarketplace/custom-plugin-postgresql

Browse all from pluginagentmarketplace/custom-plugin-postgresql

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 1
License LICENSE
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version3.0.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,013 B
  • docs SUMMARY.md 90 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 8 installs

SKILL.md

PostgreSQL PL/pgSQL Skill

Atomic skill for procedural programming

Overview

Production-ready patterns for functions, procedures, triggers, and exception handling.

Prerequisites

  • PostgreSQL 16+
  • Understanding of SQL

Parameters

parameters:
  code_type:
    type: string
    required: true
    enum: [function, procedure, trigger, aggregate]
  volatility:
    type: string
    enum: [IMMUTABLE, STABLE, VOLATILE]

Quick Reference

Function Template

CREATE OR REPLACE FUNCTION func_name(p_param TYPE)
RETURNS return_type
LANGUAGE plpgsql STABLE SECURITY DEFINER
SET search_path = app, public
AS $$ DECLARE v_result TYPE; BEGIN
    -- Logic
    RETURN v_result;
EXCEPTION WHEN OTHERS THEN
    RAISE WARNING '%', SQLERRM;
    RETURN NULL;
END; $$;

Trigger Template

CREATE OR REPLACE FUNCTION trigger_func() RETURNS TRIGGER AS $$
BEGIN
    IF TG_OP = 'UPDATE' THEN NEW.updated_at := NOW(); END IF;
    RETURN NEW;
END; $$ LANGUAGE plpgsql;

CREATE TRIGGER trg_name BEFORE UPDATE ON t FOR EACH ROW EXECUTE FUNCTION trigger_func();

Volatility

Category Use Case
IMMUTABLE Math, formatting
STABLE Lookups (no writes)
VOLATILE INSERT, random()

Exception Handling

EXCEPTION
    WHEN unique_violation THEN ...  -- 23505
    WHEN foreign_key_violation THEN ...  -- 23503
    WHEN OTHERS THEN RAISE EXCEPTION '% [%]', SQLERRM, SQLSTATE;

Troubleshooting

Error Cause Solution
42883 Function not found Check signature
42P13 Invalid definition Review syntax
Trigger not firing Wrong timing Check BEFORE/AFTER

Usage

Skill("postgresql-plpgsql")