mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user