diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2016-09-06 12:00:00 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2016-09-06 12:00:00 -0400 |
commit | 49eb0fd0972d14014dd3533b1f1bf8c94c899883 (patch) | |
tree | bcbfa5cf8f49c1b73066a5c4eaf80f33fc4ecc53 /contrib/file_fdw/file_fdw.c | |
parent | 975768f8eae2581b89ceafe8b16a77ff375207fe (diff) | |
download | postgresql-49eb0fd0972d14014dd3533b1f1bf8c94c899883.tar.gz postgresql-49eb0fd0972d14014dd3533b1f1bf8c94c899883.zip |
Add location field to DefElem
Add a location field to the DefElem struct, used to parse many utility
commands. Update various error messages to supply error position
information.
To propogate the error position information in a more systematic way,
create a ParseState in standard_ProcessUtility() and pass that to
interested functions implementing the utility commands. This seems
better than passing the query string and then reassembling a parse state
ad hoc, which violates the encapsulation of the ParseState type.
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Diffstat (limited to 'contrib/file_fdw/file_fdw.c')
-rw-r--r-- | contrib/file_fdw/file_fdw.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c index b42de873e0f..b4719913183 100644 --- a/contrib/file_fdw/file_fdw.c +++ b/contrib/file_fdw/file_fdw.c @@ -293,7 +293,7 @@ file_fdw_validator(PG_FUNCTION_ARGS) /* * Now apply the core COPY code's validation logic for more checks. */ - ProcessCopyOptions(NULL, true, other_options); + ProcessCopyOptions(NULL, NULL, true, other_options); /* * Filename option is required for file_fdw foreign tables. @@ -455,10 +455,10 @@ get_file_fdw_attribute_options(Oid relid) * force_null options set */ if (fnncolumns != NIL) - options = lappend(options, makeDefElem("force_not_null", (Node *) fnncolumns)); + options = lappend(options, makeDefElem("force_not_null", (Node *) fnncolumns, -1)); if (fncolumns != NIL) - options = lappend(options, makeDefElem("force_null", (Node *) fncolumns)); + options = lappend(options, makeDefElem("force_null", (Node *) fncolumns, -1)); return options; } @@ -511,7 +511,7 @@ fileGetForeignPaths(PlannerInfo *root, foreigntableid, &columns)) coptions = list_make1(makeDefElem("convert_selectively", - (Node *) columns)); + (Node *) columns, -1)); /* Estimate costs */ estimate_costs(root, baserel, fdw_private, @@ -632,7 +632,8 @@ fileBeginForeignScan(ForeignScanState *node, int eflags) * Create CopyState from FDW options. We always acquire all columns, so * as to match the expected ScanTupleSlot signature. */ - cstate = BeginCopyFrom(node->ss.ss_currentRelation, + cstate = BeginCopyFrom(NULL, + node->ss.ss_currentRelation, filename, false, NIL, @@ -705,7 +706,8 @@ fileReScanForeignScan(ForeignScanState *node) EndCopyFrom(festate->cstate); - festate->cstate = BeginCopyFrom(node->ss.ss_currentRelation, + festate->cstate = BeginCopyFrom(NULL, + node->ss.ss_currentRelation, festate->filename, false, NIL, @@ -1053,7 +1055,7 @@ file_acquire_sample_rows(Relation onerel, int elevel, /* * Create CopyState from FDW options. */ - cstate = BeginCopyFrom(onerel, filename, false, NIL, options); + cstate = BeginCopyFrom(NULL, onerel, filename, false, NIL, options); /* * Use per-tuple memory context to prevent leak of memory used to read |