Query processing

Raw parse tree

Also called: raw statement, RawStmt, parse tree

The first thing PostgreSQL builds from your SQL text is a raw parse tree: a structural representation of the sentence produced purely from grammar. It captures what you typed without checking whether any of the tables or columns actually exist.

What this means

The very first thing Postgres builds from your SQL text: a structural breakdown based purely on grammar. It captures the shape of what you typed, that this is a SELECT and here is its WHERE, without yet checking whether any of those tables or columns actually exist.

Why it matters operationally

This is the only stage where a syntax error can occur. Because it does no catalog lookups, a query can parse perfectly and still fail a moment later at the analysis stage with "relation does not exist". Knowing the split tells you which kind of error you are looking at.

Related & next

The Parse, Plan, Execute Pipeline, where the raw tree fitsQuery tree, what the raw tree becomes after analysis

Mentioned from

← All glossary terms · GUC reference · Error catalog