Back to Skills

PostgreSQL Syntax Reference

Consult PostgreSQL's parser and grammar (gram.y) to understand SQL syntax, DDL statement structure, and parsing rules when implementing pgschema features

133stars17forksUpdated 3/7/2026

Security Assessment

Safe(100/100)
Security Score100/100

About PostgreSQL Syntax Reference

The PostgreSQL Syntax Reference skill provides a comprehensive guide for understanding PostgreSQL's SQL syntax, parsing rules, and Data Definition Language (DDL) statement structure. It is an essential tool for developers working with PostgreSQL databases, helping them implement accurate SQL parsing and generate valid DDL statements. This skill is based on the PostgreSQL parser's grammar (gram.y), which is pivotal for recognizing and structuring SQL queries, ensuring that SQL files are parsed correctly and SQL statements are generated without error. The skill guides users through the process of parsing complex SQL constructs, understanding precedence rules, and working with PostgreSQL-specific syntax extensions.

FAQ

When should I use the PostgreSQL Syntax Reference skill?

You should use this skill when implementing or debugging SQL parsing, especially in relation to PostgreSQL SQL statements like CREATE TABLE, CREATE TRIGGER, and others. It's also useful when generating DDL statements or validating SQL syntax.

What files and directories should I reference when using this skill?

Key files to reference include 'gram.y' for grammar definitions, 'scan.l' for tokenization rules, and various parsing and transformation files like 'parse_clause.c' for clause parsing and 'parse_utilcmd.c' for DDL statements.

Is there a specific workflow to follow when using this skill?

Yes, the recommended workflow is to first identify the SQL statement type, locate the relevant grammar rule in 'gram.y', and then understand the structure and elements of the SQL statement as defined in the grammar.

Are there limitations in this skill?

This skill focuses primarily on PostgreSQL SQL syntax and grammar, so it may not be applicable to other database systems. Additionally, it assumes familiarity with the PostgreSQL codebase and may require a solid understanding of C and Yacc/Bison syntax.

All Files

2 files
metadata.json0.6 KB
View
SKILL.md16.3 KB
View

Install PostgreSQL Syntax Reference

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill