77 * Portions Copyright (c) 1994-5, Regents of the University of California
88 *
99 * IDENTIFICATION
10- * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.141 2005/11/26 22:14:56 tgl Exp $
10+ * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.142 2005/11/29 01:25:49 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -45,7 +45,7 @@ typedef struct ExplainState
4545} ExplainState ;
4646
4747static void ExplainOneQuery (Query * query , ExplainStmt * stmt ,
48- TupOutputState * tstate );
48+ ParamListInfo params , TupOutputState * tstate );
4949static double elapsed_time (instr_time * starttime );
5050static void explain_outNode (StringInfo str ,
5151 Plan * plan , PlanState * planstate ,
@@ -67,7 +67,7 @@ static void show_sort_keys(List *tlist, int nkeys, AttrNumber *keycols,
6767 * execute an EXPLAIN command
6868 */
6969void
70- ExplainQuery (ExplainStmt * stmt , DestReceiver * dest )
70+ ExplainQuery (ExplainStmt * stmt , ParamListInfo params , DestReceiver * dest )
7171{
7272 Query * query = stmt -> query ;
7373 TupOutputState * tstate ;
@@ -91,9 +91,9 @@ ExplainQuery(ExplainStmt *stmt, DestReceiver *dest)
9191 {
9292 /* Rewriter will not cope with utility statements */
9393 if (query -> utilityStmt && IsA (query -> utilityStmt , DeclareCursorStmt ))
94- ExplainOneQuery (query , stmt , tstate );
94+ ExplainOneQuery (query , stmt , params , tstate );
9595 else if (query -> utilityStmt && IsA (query -> utilityStmt , ExecuteStmt ))
96- ExplainExecuteQuery (stmt , tstate );
96+ ExplainExecuteQuery (stmt , params , tstate );
9797 else
9898 do_text_output_oneline (tstate , "Utility statements have no plan structure" );
9999 }
@@ -118,7 +118,7 @@ ExplainQuery(ExplainStmt *stmt, DestReceiver *dest)
118118 /* Explain every plan */
119119 foreach (l , rewritten )
120120 {
121- ExplainOneQuery (lfirst (l ), stmt , tstate );
121+ ExplainOneQuery (lfirst (l ), stmt , params , tstate );
122122 /* put a blank line between plans */
123123 if (lnext (l ) != NULL )
124124 do_text_output_oneline (tstate , "" );
@@ -150,7 +150,8 @@ ExplainResultDesc(ExplainStmt *stmt)
150150 * print out the execution plan for one query
151151 */
152152static void
153- ExplainOneQuery (Query * query , ExplainStmt * stmt , TupOutputState * tstate )
153+ ExplainOneQuery (Query * query , ExplainStmt * stmt , ParamListInfo params ,
154+ TupOutputState * tstate )
154155{
155156 Plan * plan ;
156157 QueryDesc * queryDesc ;
@@ -208,7 +209,7 @@ ExplainOneQuery(Query *query, ExplainStmt *stmt, TupOutputState *tstate)
208209 /* Create a QueryDesc requesting no output */
209210 queryDesc = CreateQueryDesc (query , plan ,
210211 ActiveSnapshot , InvalidSnapshot ,
211- None_Receiver , NULL ,
212+ None_Receiver , params ,
212213 stmt -> analyze );
213214
214215 ExplainOnePlan (queryDesc , stmt , tstate );
0 commit comments