resource-owners

Automate management and cleanup of reference-counted PostgreSQL resources via ResourceOwner infrastructure.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/matejformanek/postgres-claude --skill resource-owners
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: resource-owners
Source: https://github.com/matejformanek/postgres-claude/tree/main/.claude/skills/resource-owners
Command: npx skills add https://github.com/matejformanek/postgres-claude --skill resource-owners

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the complexity of tracking and cleaning up reference-counted resources like buffer pins, catcache references, and DSM segments, preventing memory leaks and dangling pointers in PostgreSQL backend code.

Core Features & Use Cases

  • Lifecycle Automation: Automatically releases resources at transaction, subtransaction, or portal boundaries.
  • Callback API Integration: Provides guidance on implementing the PG 17+ callback-based resource management system for extensions and core subsystems.
  • Debugging: Assists in diagnosing and resolving resource-owner-leak warnings by identifying improper cleanup paths or incorrect resource-owner scoping.

Quick Start

Use the resource-owners skill to debug a resource leak warning and implement the correct callback-based release pattern for a new resource kind.

Frequently Asked Questions about resource-owners

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix resource owner leak warnings in PostgreSQL backend code?

PostgreSQL resource owner leaks occur when reference-counted resources like buffer pins or catcache references are not properly released. This skill diagnoses improper cleanup paths and incorrect resource-owner scoping to resolve leak warnings.

How do I implement the callback-based resource management system in PostgreSQL 17?

The callback-based resource management system in PostgreSQL 17 requires registering reference-counted resources through the ResourceOwner infrastructure. This skill provides guidance on implementing three-phase release discipline and callback-based resource registration for extensions and core subsystems.

What is the best way to manage buffer pins and catcache references across subtransaction boundaries?

Managing buffer pins and catcache references across subtransaction boundaries requires the ResourceOwner infrastructure to automate lifecycle cleanup. This skill ensures reference-counted resources are released at transaction, subtransaction, or portal boundaries to prevent memory leaks.

Does PostgreSQL 17 require a three-phase release discipline for custom resource kinds?

PostgreSQL 17 requires a three-phase release discipline for custom resource kinds managed through the ResourceOwner infrastructure. This skill applies the callback-based registration pattern needed to safely automate cleanup of new resource types in backend extensions.

Why are my DSM segments causing dangling pointers in PostgreSQL backend extensions?

DSM segments cause dangling pointers in PostgreSQL backend extensions when their reference counts are not tracked within the correct resource-owner scope. This skill automates the management and cleanup of DSM segments and other reference-counted resources to prevent such memory safety issues.