[prev] 60 [next]

PostgreSQL Source Code (cont)

exec_simple_query(const char *query_string)
  • defined in src/backend/tcop/postgres.c
  • entry point for evaluating SQL queries
  • assumes query_string is one or more SQL statements

parsetree_list = pg_parse_query(query_string);
foreach(parsetree, parsetree_list) {
  querytree_list = pg_analyze_and_rewrite(parsetree, ...);
  plantree_list = pg_plan_queries(querytree_list, ...);
  portal = CreatePortal(...); // query execution env
  PortalDefineQuery(portal, ..., plantree_list, ...);
  receiver = CreateDestReceiver(dest); // client
  PortalRun(portal, ..., receiver, ...);
  ...
}