SQL parser is an important subsystem in PostgreSQL because it understands SQL queries and turns it into a machine readable form so that subsequent subsystems can easily handle user's SQL. In this talk I will explain the internal of SQL parser through an experience in porting it to other applications.
PostgreSQL query processing architecture consists 4 steps: parser, rewriter, optimizer and executor. The parser is a PostgreSQL internal module to parse the SQL from application and returns an internal PostgreSQL parse tree.
The SQL parser is divided into two pieces: raw parser which is responsible for syntactic analysis of SQL, and analyzer which adds semantics information by looking up system catalogs.
In this talk, firstly I will explain the internal of the SQL parser. Next, because there are many applications which want to have an SQL parser, I will show you how to port the raw parser to an application by using Pgpool-II as a concrete example. |