@@ -85,7 +85,7 @@ static MemoryContext anl_context = NULL;
8585static BufferAccessStrategy vac_strategy ;
8686
8787
88- static void do_analyze_rel (Relation onerel ,VacuumStmt * vacstmt ,
88+ static void do_analyze_rel (Relation onerel ,int options , List * va_cols ,
8989AcquireSampleRowsFunc acquirefunc ,BlockNumber relpages ,
9090bool inh ,bool in_outer_xact ,int elevel );
9191static void BlockSampler_Init (BlockSampler bs ,BlockNumber nblocks ,
@@ -115,7 +115,7 @@ static Datum ind_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull);
115115 *analyze_rel() -- analyze one relation
116116 */
117117void
118- analyze_rel (Oid relid ,VacuumStmt * vacstmt ,
118+ analyze_rel (Oid relid ,RangeVar * relation , int options , List * va_cols ,
119119bool in_outer_xact ,BufferAccessStrategy bstrategy )
120120{
121121Relation onerel ;
@@ -124,7 +124,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
124124BlockNumber relpages = 0 ;
125125
126126/* Select logging level */
127- if (vacstmt -> options & VACOPT_VERBOSE )
127+ if (options & VACOPT_VERBOSE )
128128elevel = INFO ;
129129else
130130elevel = DEBUG2 ;
@@ -144,7 +144,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
144144 * matter if we ever try to accumulate stats on dead tuples.) If the rel
145145 * has been dropped since we last saw it, we don't need to process it.
146146 */
147- if (!(vacstmt -> options & VACOPT_NOWAIT ))
147+ if (!(options & VACOPT_NOWAIT ))
148148onerel = try_relation_open (relid ,ShareUpdateExclusiveLock );
149149else if (ConditionalLockRelationOid (relid ,ShareUpdateExclusiveLock ))
150150onerel = try_relation_open (relid ,NoLock );
@@ -155,7 +155,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
155155ereport (LOG ,
156156(errcode (ERRCODE_LOCK_NOT_AVAILABLE ),
157157errmsg ("skipping analyze of \"%s\" --- lock not available" ,
158- vacstmt -> relation -> relname )));
158+ relation -> relname )));
159159}
160160if (!onerel )
161161return ;
@@ -167,7 +167,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
167167 (pg_database_ownercheck (MyDatabaseId ,GetUserId ())&& !onerel -> rd_rel -> relisshared )))
168168{
169169/* No need for a WARNING if we already complained during VACUUM */
170- if (!(vacstmt -> options & VACOPT_VACUUM ))
170+ if (!(options & VACOPT_VACUUM ))
171171{
172172if (onerel -> rd_rel -> relisshared )
173173ereport (WARNING ,
@@ -248,7 +248,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
248248else
249249{
250250/* No need for a WARNING if we already complained during VACUUM */
251- if (!(vacstmt -> options & VACOPT_VACUUM ))
251+ if (!(options & VACOPT_VACUUM ))
252252ereport (WARNING ,
253253(errmsg ("skipping \"%s\" --- cannot analyze non-tables or special system tables" ,
254254RelationGetRelationName (onerel ))));
@@ -266,14 +266,14 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
266266/*
267267 * Do the normal non-recursive ANALYZE.
268268 */
269- do_analyze_rel (onerel ,vacstmt ,acquirefunc ,relpages ,
269+ do_analyze_rel (onerel ,options , va_cols ,acquirefunc ,relpages ,
270270 false,in_outer_xact ,elevel );
271271
272272/*
273273 * If there are child tables, do recursive ANALYZE.
274274 */
275275if (onerel -> rd_rel -> relhassubclass )
276- do_analyze_rel (onerel ,vacstmt ,acquirefunc ,relpages ,
276+ do_analyze_rel (onerel ,options , va_cols ,acquirefunc ,relpages ,
277277 true,in_outer_xact ,elevel );
278278
279279/*
@@ -302,7 +302,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
302302 * acquirefunc for each child table.
303303 */
304304static void
305- do_analyze_rel (Relation onerel ,VacuumStmt * vacstmt ,
305+ do_analyze_rel (Relation onerel ,int options , List * va_cols ,
306306AcquireSampleRowsFunc acquirefunc ,BlockNumber relpages ,
307307bool inh ,bool in_outer_xact ,int elevel )
308308{
@@ -372,14 +372,14 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt,
372372 *
373373 * Note that system attributes are never analyzed.
374374 */
375- if (vacstmt -> va_cols != NIL )
375+ if (va_cols != NIL )
376376{
377377ListCell * le ;
378378
379- vacattrstats = (VacAttrStats * * )palloc (list_length (vacstmt -> va_cols )*
379+ vacattrstats = (VacAttrStats * * )palloc (list_length (va_cols )*
380380sizeof (VacAttrStats * ));
381381tcnt = 0 ;
382- foreach (le ,vacstmt -> va_cols )
382+ foreach (le ,va_cols )
383383{
384384char * col = strVal (lfirst (le ));
385385
@@ -436,7 +436,7 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt,
436436
437437thisdata -> indexInfo = indexInfo = BuildIndexInfo (Irel [ind ]);
438438thisdata -> tupleFract = 1.0 ;/* fix later if partial */
439- if (indexInfo -> ii_Expressions != NIL && vacstmt -> va_cols == NIL )
439+ if (indexInfo -> ii_Expressions != NIL && va_cols == NIL )
440440{
441441ListCell * indexpr_item = list_head (indexInfo -> ii_Expressions );
442442
@@ -595,7 +595,7 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt,
595595 * VACUUM ANALYZE, don't overwrite the accurate count already inserted by
596596 * VACUUM.
597597 */
598- if (!inh && !(vacstmt -> options & VACOPT_VACUUM ))
598+ if (!inh && !(options & VACOPT_VACUUM ))
599599{
600600for (ind = 0 ;ind < nindexes ;ind ++ )
601601{
@@ -623,7 +623,7 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt,
623623pgstat_report_analyze (onerel ,totalrows ,totaldeadrows );
624624
625625/* If this isn't part of VACUUM ANALYZE, let index AMs do cleanup */
626- if (!(vacstmt -> options & VACOPT_VACUUM ))
626+ if (!(options & VACOPT_VACUUM ))
627627{
628628for (ind = 0 ;ind < nindexes ;ind ++ )
629629{