PostgreSQL Syntax Reference

Parse PostgreSQL SQL and generate valid DDL in pgschema.

994|57|Updated Jun 8, 2025
One-click install
npx skills add https://github.com/pgplex/pgschema --skill postgresql-syntax-reference-pgplex
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: PostgreSQL Syntax Reference
Source: https://github.com/pgplex/pgschema/tree/main/.claude/skills/postgres_syntax
Command: npx skills add https://github.com/pgplex/pgschema --skill postgresql-syntax-reference-pgplex

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Understand PostgreSQL syntax and grammar to correctly parse SQL and generate valid DDL in pgschema.

Core Features & Use Cases

  • Reference to the grammar and parser components (gram.y, scan.l, keywords.c) for implementing and auditing SQL parsing rules.
  • Guide for debugging complex SQL constructs, validating DDL generation, and ensuring compatibility across PostgreSQL versions.
  • Clear mapping between parser definitions and DDL generation workflows in pgschema.

Quick Start

Read the PostgreSQL grammar reference and related parser sources to inform your pgschema feature development.

Frequently Asked Questions about PostgreSQL Syntax Reference

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

FAQPage Schema
How do I debug PostgreSQL syntax parsing issues in gram.y?

To debug PostgreSQL syntax parsing in gram.y, reference the grammar definitions alongside scan.l and keywords.c to trace SQL construct parsing rules, identify grammar conflicts, and validate DDL generation workflows for pgschema.

What is the best way to validate DDL generation across PostgreSQL versions?

Validating DDL generation across PostgreSQL versions requires consulting parser components like gram.y and keywords.c to ensure SQL constructs and grammar rules align with specific version definitions, enabling accurate parsing and valid DDL output.

How does the PostgreSQL parser handle complex SQL constructs in scan.l?

The PostgreSQL parser handles complex SQL constructs in scan.l by defining lexical tokenization rules that feed into gram.y grammar definitions, ensuring accurate parsing of SQL statements and supporting correct DDL generation in pgschema.

Can I use PostgreSQL grammar references to implement SQL parsing rules?

Yes, PostgreSQL grammar references like gram.y, scan.l, and keywords.c provide the foundational parser definitions needed to implement, audit, and map SQL parsing rules accurately for DDL generation workflows in pgschema.

Why does my PostgreSQL DDL generation fail on certain SQL syntax?

PostgreSQL DDL generation fails on certain SQL syntax when parser definitions in gram.y and scan.l are not fully consulted, causing mismatches between SQL constructs and grammar rules across different PostgreSQL versions.

When do I need to consult keywords.c for PostgreSQL syntax parsing?

You need to consult keywords.c for PostgreSQL syntax parsing when auditing keyword classifications, validating reserved word handling, or ensuring SQL constructs parse correctly before generating DDL in pgschema across PostgreSQL versions.