compiler.captureDiagnosticContext(planString);
// Stuff the explain plan in an annotation for report generation.
// N.B. The explain plan is actually in the catalog as of 5/28/13, but
// plans are in place to remove it shortly.
StatementAnnotation annotation = new StatementAnnotation();
annotation.explainPlan = plan.explainedPlan;
catalogStmt.setAnnotation(annotation);
// build usage links for report generation
CatalogUtil.updateUsageAnnotations(db, catalogStmt, plan.rootPlanGraph, plan.subPlanGraph);