type-cache

Analyze PostgreSQL backend type-info cache internals for invalidation and typmod registry issues.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill resolves complex debugging and implementation challenges related to PostgreSQL's per-backend type-info cache, preventing hallucinations regarding locking, memory contexts, and catalog invalidation.

Core Features & Use Cases

  • Internals Guidance: Provides authoritative context on TypeCacheEntry structures, lookup patterns, and syscache invalidation triggers.
  • Parallel Query Support: Explains the interaction between shared RECORD typmod registries and parallel workers.
  • Use Case: When investigating a bug where a custom data type fails to resolve hash or equality functions, use this skill to verify if the typcache flags are correctly populated and if invalidation callbacks are firing as expected.

Quick Start

Use the type-cache skill to analyze the current implementation of lookup_type_cache and identify potential invalidation issues in the backend.

Frequently Asked Questions about type-cache

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

FAQPage Schema
How does PostgreSQL typcache invalidation work for custom data types?

PostgreSQL typcache invalidation relies on syscache callbacks to flush TypeCacheEntry structures when catalog definitions change. This ensures stale type metadata, like hash or equality functions, gets discarded and rebuilt during subsequent lookups.

Why does a custom PostgreSQL data type fail to resolve hash or equality functions?

A custom data type fails to resolve hash or equality functions when typcache flags are not correctly populated or syscache invalidation callbacks fail to fire. Analyzing lookup_type_cache helps verify if the type-info cache is properly updating.

How do parallel workers interact with the shared RECORD typmod registry in PostgreSQL?

Parallel workers interact with the shared RECORD typmod registry by accessing coordinated type-info cache entries. This ensures anonymous RECORD types maintain consistent typmod assignments across the parallel query execution backend.

What is the best way to debug PostgreSQL backend type-info cache issues?

The best way to debug PostgreSQL backend type-info cache issues is to analyze the lookup_type_cache implementation within typcache.c, verifying locking behavior, memory contexts, and catalog invalidation triggers to resolve inconsistencies.

Do I need to understand typcache.c internals to submit PostgreSQL database patches?

Yes, submitting PostgreSQL patches for type-related traits requires a deep understanding of typcache.c internals, including TypeCacheEntry structures, syscache callbacks, and catalog-driven cache behavior, to prevent implementation hallucinations.