@@ -109,17 +109,17 @@ PG_FUNCTION_INFO_V1(file_fdw_validator);
109
109
* FDW callback routines
110
110
*/
111
111
static void fileGetForeignRelSize (PlannerInfo * root ,
112
- RelOptInfo * baserel ,
113
- Oid foreigntableid );
112
+ RelOptInfo * baserel ,
113
+ Oid foreigntableid );
114
114
static void fileGetForeignPaths (PlannerInfo * root ,
115
- RelOptInfo * baserel ,
116
- Oid foreigntableid );
115
+ RelOptInfo * baserel ,
116
+ Oid foreigntableid );
117
117
static 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 );
123
123
static void fileExplainForeignScan (ForeignScanState * node , ExplainState * es );
124
124
static void fileBeginForeignScan (ForeignScanState * node , int eflags );
125
125
static TupleTableSlot * fileIterateForeignScan (ForeignScanState * node );
@@ -141,7 +141,7 @@ static void estimate_size(PlannerInfo *root, RelOptInfo *baserel,
141
141
static void estimate_costs (PlannerInfo * root , RelOptInfo * baserel ,
142
142
FileFdwPlanState * fdw_private ,
143
143
Cost * 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 ,
145
145
HeapTuple * rows , int targrows ,
146
146
double * totalrows , double * totaldeadrows );
147
147
@@ -180,7 +180,7 @@ file_fdw_validator(PG_FUNCTION_ARGS)
180
180
List * options_list = untransformRelOptions (PG_GETARG_DATUM (0 ));
181
181
Oid catalog = PG_GETARG_OID (1 );
182
182
char * filename = NULL ;
183
- DefElem * force_not_null = NULL ;
183
+ DefElem * force_not_null = NULL ;
184
184
List * other_options = NIL ;
185
185
ListCell * cell ;
186
186
@@ -233,7 +233,7 @@ file_fdw_validator(PG_FUNCTION_ARGS)
233
233
buf .len > 0
234
234
? errhint ("Valid options in this context are: %s" ,
235
235
buf .data )
236
- : errhint ("There are no valid options in this context." )));
236
+ : errhint ("There are no valid options in this context." )));
237
237
}
238
238
239
239
/*
@@ -393,13 +393,13 @@ get_file_fdw_attribute_options(Oid relid)
393
393
options = GetForeignColumnOptions (relid , attnum );
394
394
foreach (lc , options )
395
395
{
396
- DefElem * def = (DefElem * ) lfirst (lc );
396
+ DefElem * def = (DefElem * ) lfirst (lc );
397
397
398
398
if (strcmp (def -> defname , "force_not_null" ) == 0 )
399
399
{
400
400
if (defGetBoolean (def ))
401
401
{
402
- char * attname = pstrdup (NameStr (attr -> attname ));
402
+ char * attname = pstrdup (NameStr (attr -> attname ));
403
403
404
404
fnncolumns = lappend (fnncolumns , makeString (attname ));
405
405
}
@@ -429,8 +429,8 @@ fileGetForeignRelSize(PlannerInfo *root,
429
429
FileFdwPlanState * fdw_private ;
430
430
431
431
/*
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.
434
434
*/
435
435
fdw_private = (FileFdwPlanState * ) palloc (sizeof (FileFdwPlanState ));
436
436
fileGetOptions (foreigntableid ,
@@ -468,13 +468,14 @@ fileGetForeignPaths(PlannerInfo *root,
468
468
baserel -> rows ,
469
469
startup_cost ,
470
470
total_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 */
474
474
475
475
/*
476
476
* 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.
478
479
*/
479
480
}
480
481
@@ -505,8 +506,8 @@ fileGetForeignPlan(PlannerInfo *root,
505
506
return make_foreignscan (tlist ,
506
507
scan_clauses ,
507
508
scan_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 */
510
511
}
511
512
512
513
/*
@@ -665,14 +666,14 @@ fileAnalyzeForeignTable(Relation relation,
665
666
{
666
667
char * filename ;
667
668
List * options ;
668
- struct stat stat_buf ;
669
+ struct stat stat_buf ;
669
670
670
671
/* Fetch options of foreign table */
671
672
fileGetOptions (RelationGetRelid (relation ), & filename , & options );
672
673
673
674
/*
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?)
676
677
*/
677
678
if (stat (filename , & stat_buf ) < 0 )
678
679
ereport (ERROR ,
@@ -746,7 +747,7 @@ estimate_size(PlannerInfo *root, RelOptInfo *baserel,
746
747
* planner's idea of the relation width; which is bogus if not all
747
748
* columns are being read, not to mention that the text representation
748
749
* 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
750
751
* real answer to anyone who complains is "ANALYZE" ...
751
752
*/
752
753
int tuple_width ;
@@ -811,7 +812,7 @@ estimate_costs(PlannerInfo *root, RelOptInfo *baserel,
811
812
* which must have at least targrows entries.
812
813
* The actual number of rows selected is returned as the function result.
813
814
* 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.
815
816
*
816
817
* Note that the returned list of rows is not always in order by physical
817
818
* position in the file. Therefore, correlation estimates derived later
@@ -824,7 +825,7 @@ file_acquire_sample_rows(Relation onerel, int elevel,
824
825
double * totalrows , double * totaldeadrows )
825
826
{
826
827
int numrows = 0 ;
827
- double rowstoskip = -1 ; /* -1 means not set yet */
828
+ double rowstoskip = -1 ; /* -1 means not set yet */
828
829
double rstate ;
829
830
TupleDesc tupDesc ;
830
831
Datum * values ;
@@ -853,8 +854,8 @@ file_acquire_sample_rows(Relation onerel, int elevel,
853
854
cstate = BeginCopyFrom (onerel , filename , NIL , options );
854
855
855
856
/*
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.
858
859
*/
859
860
tupcontext = AllocSetContextCreate (CurrentMemoryContext ,
860
861
"file_fdw temporary context" ,
@@ -912,10 +913,10 @@ file_acquire_sample_rows(Relation onerel, int elevel,
912
913
if (rowstoskip <= 0 )
913
914
{
914
915
/*
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
917
918
*/
918
- int k = (int ) (targrows * anl_random_fract ());
919
+ int k = (int ) (targrows * anl_random_fract ());
919
920
920
921
Assert (k >= 0 && k < targrows );
921
922
heap_freetuple (rows [k ]);
0 commit comments