mit einem Klick
pg-bnf-source-mapper
// Maps PostgreSQL parser BNF grammar statements to their corresponding PostgreSQL C source code entry points (e.g., in utility.c). Use this to find which C function handles a specific parsed SQL statement.
// Maps PostgreSQL parser BNF grammar statements to their corresponding PostgreSQL C source code entry points (e.g., in utility.c). Use this to find which C function handles a specific parsed SQL statement.
Synthesizes the outputs of pg-bnf-source-mapper, pg-write-trace-skill, and pg-read-trace-skill into a master PG_SEMANTIC_INVENTORY.json. It maps statements to regression tests (pg_regress) to provide a complete coverage plan.
Traces the PostgreSQL Analyzer (analyze.go/analyze.c) to identify which system catalogs (e.g., pg_operator, pg_type, pg_proc) are queried to resolve a specific SQL statement or semantic element. Use this to identify dependencies.
Traces PostgreSQL C source code to identify which system catalogs (e.g., pg_class, pg_attribute) are modified (inserted, updated, or deleted) by a specific handler function. Use this to find the side-effects of a DDL statement.
Maps PostgreSQL parser BNF grammar statements to their corresponding PostgreSQL C source code entry points (e.g., in utility.c). Use this to find which C function handles a specific parsed SQL statement.
Synthesizes the outputs of pg-bnf-source-mapper, pg-write-trace-skill, and pg-read-trace-skill into a master PG_SEMANTIC_INVENTORY.json. It maps statements to regression tests (pg_regress) to provide a complete coverage plan.
Traces the PostgreSQL Analyzer (analyze.go/analyze.c) to identify which system catalogs (e.g., pg_operator, pg_type, pg_proc) are queried to resolve a specific SQL statement or semantic element. Use this to identify dependencies.
| name | pg-bnf-source-mapper |
| description | Maps PostgreSQL parser BNF grammar statements to their corresponding PostgreSQL C source code entry points (e.g., in utility.c). Use this to find which C function handles a specific parsed SQL statement. |
You are an expert PostgreSQL source code investigator. Your task is to map PostgreSQL parser grammar (BNF/AST nodes) to their primary C source code entry points.
This is Step 1 of building the PostgreSQL Semantic Fidelity Pipeline. We are mapping the "Syntax" (what the user types) to the "Source" (where PostgreSQL handles it) to prepare for semantic coverage analysis.
CreateStmt, AlterTableStmt).src/backend/tcop/utility.c for DDL dispatch, or src/backend/parser/analyze.c for queries).DefineRelation in src/backend/commands/tablecmds.c).ProcessUtility in src/backend/tcop/utility.c is the main router for DDL. Search for case T_CreateStmt: or similar T_NodeName tags.src/backend/parser/analyze.c (e.g., transformSelectStmt, transformInsertStmt).src/backend/commands/ (for DDL) or src/backend/catalog/ (for system catalog updates).Output exactly the following JSON block for each mapping. Do not wrap it in other text if processing in batch mode, unless requested.
{
"statement": "CREATE TABLE",
"bnf_slug": "create-table-stmt",
"ast_node": "CreateStmt",
"pg_source": "src/backend/commands/tablecmds.c:DefineRelation"
}
Some batches (e.g., "names", "types", "infrastructure") contain low-level components or tokens rather than standalone SQL statements.
utility.c for these.RangeVar, TypeName) to their primary constructor or resolution functions in the PostgreSQL backend:
src/backend/nodes/makefuncs.csrc/backend/parser/parse_node.c or src/backend/catalog/namespace.csrc/backend/parser/parse_type.cpg_source.