What problem does it solve?
This skill addresses the complexity of writing safe, performant, and correct C-language extensions for PostgreSQL, specifically handling the intricacies of the Function Manager (fmgr) and the Server Programming Interface (SPI).
Core Features & Use Cases
- SQL-Callable C Functions: Provides the boilerplate and safety rules for implementing V1-style C functions, including argument extraction, NULL handling, and detoasting.
- SPI Integration: Offers a robust playbook for executing SQL queries from within backend C code, including plan caching, cursor management, and subtransaction handling.
- Use Case: Use this skill when developing custom PostgreSQL extensions that require high-performance C logic, complex data type manipulation, or embedded SQL execution within triggers and procedures.
Quick Start
Use the fmgr-and-spi skill to generate the boilerplate for a new SQL-callable C function that performs a complex calculation using SPI to query internal system catalogs.