@@ -109,17 +109,17 @@ PG_FUNCTION_INFO_V1(file_fdw_validator);
109109 * FDW callback routines
110110 */
111111static void fileGetForeignRelSize (PlannerInfo * root ,
112- RelOptInfo * baserel ,
113- Oid foreigntableid );
112+ RelOptInfo * baserel ,
113+ Oid foreigntableid );
114114static void fileGetForeignPaths (PlannerInfo * root ,
115- RelOptInfo * baserel ,
116- Oid foreigntableid );
115+ RelOptInfo * baserel ,
116+ Oid foreigntableid );
117117static ForeignScan * fileGetForeignPlan (PlannerInfo * root ,
118- RelOptInfo * baserel ,
119- Oid foreigntableid ,
120- ForeignPath * best_path ,
121- List * tlist ,
122- List * scan_clauses );
118+ RelOptInfo * baserel ,
119+ Oid foreigntableid ,
120+ ForeignPath * best_path ,
121+ List * tlist ,
122+ List * scan_clauses );
123123static void fileExplainForeignScan (ForeignScanState * node ,ExplainState * es );
124124static void fileBeginForeignScan (ForeignScanState * node ,int eflags );
125125static TupleTableSlot * fileIterateForeignScan (ForeignScanState * node );
@@ -141,7 +141,7 @@ static void estimate_size(PlannerInfo *root, RelOptInfo *baserel,
141141static void estimate_costs (PlannerInfo * root ,RelOptInfo * baserel ,
142142FileFdwPlanState * fdw_private ,
143143Cost * startup_cost ,Cost * total_cost );
144- static int file_acquire_sample_rows (Relation onerel ,int elevel ,
144+ static int file_acquire_sample_rows (Relation onerel ,int elevel ,
145145HeapTuple * rows ,int targrows ,
146146double * totalrows ,double * totaldeadrows );
147147
@@ -180,7 +180,7 @@ file_fdw_validator(PG_FUNCTION_ARGS)
180180List * options_list = untransformRelOptions (PG_GETARG_DATUM (0 ));
181181Oid catalog = PG_GETARG_OID (1 );
182182char * filename = NULL ;
183- DefElem * force_not_null = NULL ;
183+ DefElem * force_not_null = NULL ;
184184List * other_options = NIL ;
185185ListCell * cell ;
186186
@@ -233,7 +233,7 @@ file_fdw_validator(PG_FUNCTION_ARGS)
233233buf .len > 0
234234 ?errhint ("Valid options in this context are: %s" ,
235235buf .data )
236- :errhint ("There are no valid options in this context." )));
236+ :errhint ("There are no valid options in this context." )));
237237}
238238
239239/*
@@ -393,13 +393,13 @@ get_file_fdw_attribute_options(Oid relid)
393393options = GetForeignColumnOptions (relid ,attnum );
394394foreach (lc ,options )
395395{
396- DefElem * def = (DefElem * )lfirst (lc );
396+ DefElem * def = (DefElem * )lfirst (lc );
397397
398398if (strcmp (def -> defname ,"force_not_null" )== 0 )
399399{
400400if (defGetBoolean (def ))
401401{
402- char * attname = pstrdup (NameStr (attr -> attname ));
402+ char * attname = pstrdup (NameStr (attr -> attname ));
403403
404404fnncolumns = lappend (fnncolumns ,makeString (attname ));
405405}
@@ -429,8 +429,8 @@ fileGetForeignRelSize(PlannerInfo *root,
429429FileFdwPlanState * fdw_private ;
430430
431431/*
432- * Fetch options. We only need filename at this point, but we might
433- *as well get everything and not need to re-fetch it later in planning.
432+ * Fetch options. We only need filename at this point, but we might as
433+ * well get everything and not need to re-fetch it later in planning.
434434 */
435435fdw_private = (FileFdwPlanState * )palloc (sizeof (FileFdwPlanState ));
436436fileGetOptions (foreigntableid ,
@@ -468,13 +468,14 @@ fileGetForeignPaths(PlannerInfo *root,
468468baserel -> rows ,
469469startup_cost ,
470470total_cost ,
471- NIL ,/* no pathkeys */
472- NULL ,/* no outer rel either */
473- NIL ));/* no fdw_private data */
471+ NIL ,/* no pathkeys */
472+ NULL ,/* no outer rel either */
473+ NIL ));/* no fdw_private data */
474474
475475/*
476476 * If data file was sorted, and we knew it somehow, we could insert
477- * appropriate pathkeys into the ForeignPath node to tell the planner that.
477+ * appropriate pathkeys into the ForeignPath node to tell the planner
478+ * that.
478479 */
479480}
480481
@@ -505,8 +506,8 @@ fileGetForeignPlan(PlannerInfo *root,
505506return make_foreignscan (tlist ,
506507scan_clauses ,
507508scan_relid ,
508- NIL ,/* no expressions to evaluate */
509- NIL );/* no private state either */
509+ NIL ,/* no expressions to evaluate */
510+ NIL );/* no private state either */
510511}
511512
512513/*
@@ -665,14 +666,14 @@ fileAnalyzeForeignTable(Relation relation,
665666{
666667char * filename ;
667668List * options ;
668- struct stat stat_buf ;
669+ struct stat stat_buf ;
669670
670671/* Fetch options of foreign table */
671672fileGetOptions (RelationGetRelid (relation ),& filename ,& options );
672673
673674/*
674- * Get size of the file. (XXX if we fail here, would it be better to
675- *just return false to skip analyzing the table?)
675+ * Get size of the file. (XXX if we fail here, would it be better to just
676+ * return false to skip analyzing the table?)
676677 */
677678if (stat (filename ,& stat_buf )< 0 )
678679ereport (ERROR ,
@@ -746,7 +747,7 @@ estimate_size(PlannerInfo *root, RelOptInfo *baserel,
746747 * planner's idea of the relation width; which is bogus if not all
747748 * columns are being read, not to mention that the text representation
748749 * of a row probably isn't the same size as its internal
749- * representation. Possibly we could do something better, but the
750+ * representation. Possibly we could do something better, but the
750751 * real answer to anyone who complains is "ANALYZE" ...
751752 */
752753int tuple_width ;
@@ -811,7 +812,7 @@ estimate_costs(PlannerInfo *root, RelOptInfo *baserel,
811812 * which must have at least targrows entries.
812813 * The actual number of rows selected is returned as the function result.
813814 * We also count the total number of rows in the file and return it into
814- * *totalrows. Note that *totaldeadrows is always set to 0.
815+ * *totalrows. Note that *totaldeadrows is always set to 0.
815816 *
816817 * Note that the returned list of rows is not always in order by physical
817818 * position in the file. Therefore, correlation estimates derived later
@@ -824,7 +825,7 @@ file_acquire_sample_rows(Relation onerel, int elevel,
824825double * totalrows ,double * totaldeadrows )
825826{
826827int numrows = 0 ;
827- double rowstoskip = -1 ;/* -1 means not set yet */
828+ double rowstoskip = -1 ;/* -1 means not set yet */
828829double rstate ;
829830TupleDesc tupDesc ;
830831Datum * values ;
@@ -853,8 +854,8 @@ file_acquire_sample_rows(Relation onerel, int elevel,
853854cstate = BeginCopyFrom (onerel ,filename ,NIL ,options );
854855
855856/*
856- * Use per-tuple memory context to prevent leak of memory used to read rows
857- * from the file with Copy routines.
857+ * Use per-tuple memory context to prevent leak of memory used to read
858+ *rows from the file with Copy routines.
858859 */
859860tupcontext = AllocSetContextCreate (CurrentMemoryContext ,
860861"file_fdw temporary context" ,
@@ -912,10 +913,10 @@ file_acquire_sample_rows(Relation onerel, int elevel,
912913if (rowstoskip <=0 )
913914{
914915/*
915- * Found a suitable tuple, so save it, replacing one
916- *old tuple at random
916+ * Found a suitable tuple, so save it, replacing one old tuple
917+ * at random
917918 */
918- int k = (int ) (targrows * anl_random_fract ());
919+ int k = (int ) (targrows * anl_random_fract ());
919920
920921Assert (k >=0 && k < targrows );
921922heap_freetuple (rows [k ]);