parser-and-nodes

Modify PostgreSQL parser grammar, AST nodes, and tree walkers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured, cited framework for navigating the complex PostgreSQL three-tree pipeline, preventing common errors when modifying the parser, grammar, or node structures.

Core Features & Use Cases

  • Pipeline Navigation: Provides authoritative guidance on the transformation from Raw Parsetree to Query tree and finally to the Plan tree.
  • Node Infrastructure: Offers precise instructions for adding new SQL statements, modifying Node types, and implementing required walker/mutator functions.
  • Use Case: When adding a new SQL keyword or extending a parse-tree node, this skill ensures you correctly update the grammar, lexer, and node support functions to maintain system integrity.

Quick Start

Use the parser-and-nodes skill to guide the implementation of a new SQL statement by following the required steps for gram.y, scan.l, and analyze.c.

Frequently Asked Questions about parser-and-nodes

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

FAQPage Schema
How do I add a new SQL statement to the PostgreSQL parser?

To add a new SQL statement to the PostgreSQL parser, you must update the grammar in gram.y, the lexer in scan.l, and the analysis logic in analyze.c to correctly transform the raw parsetree into a query tree.

How does the PostgreSQL parser transform a raw parsetree into a plan tree?

The PostgreSQL parser pipeline transforms a raw parsetree into a query tree, which the planner then converts into a plan tree, requiring strict compliance with internal node-tagging and serialization conventions during AST manipulation.

What do I need to update when extending AST nodes in PostgreSQL internals?

When extending AST nodes in PostgreSQL internals, you need to modify internal node structures and implement required tree walker or mutator functions while maintaining system integrity through proper memory management and node support functions.

Why do my custom PostgreSQL grammar modifications break the serialization process?

PostgreSQL grammar modifications break serialization when new parse-tree nodes or SQL keywords bypass the required internal node-tagging conventions, failing to correctly update node support functions across gram.y, scan.l, and analyze.c.

Can I use C programming to write tree walkers for PostgreSQL database internals?

Yes, you can use C programming to write tree walkers and mutators for PostgreSQL database internals, ensuring they correctly traverse and manipulate AST nodes according to PostgreSQL's internal memory management conventions.