Expand description
PostgreSQL’s own parser for Cufflink guests that accept SQL they did not write.
Modules§
- bounds
- What the parser is never handed: input past
MAX_INPUT_BYTES, and input whose tree could be deep enough to exhaust the parse’s stack. - golden
- The golden corpus: statements accepted and refused, and the answer this release gives each, committed so that every implementation of the parse (the parser process, the platform, the test host) is checked against fixed bytes rather than against itself.
- wire
- Between the platform and a parser process, over the process’s stdin and stdout: frames of a 4-byte big-endian length and that many bytes.
Constants§
- MAX_
TREE_ NESTING - The deepest a tree’s text may nest, in objects and arrays. A guest
reads the answer with
serde_json, which stops at 128 levels, and the answer wraps the tree in two more; a deeper tree isTooLarge. - PARSER
- The
pg_queryrelease that parses, which fixes PostgreSQL’s grammar. - PROBE
- The probe corpus: one statement a line.
- PROBE_
FINGERPRINT - The SHA-256 of
PROBE’s trees asPARSERreads them: for each statement in order, its tree’s canonical text and a\n. A parser process whose fingerprint differs is not used.
Functions§
- answer_
around - What surrounds a tree’s canonical text in the
sql_parsehost function’s answer, aParseResponse::Ok, so that the tree is written into the answer as it is read and never parsed again on the way.