MCPcopy Create free account
hub / github.com/apache/cloudberry / GetExtFromForeignTableOptions

Function GetExtFromForeignTableOptions

src/backend/access/external/external.c:203–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203ExtTableEntry *
204GetExtFromForeignTableOptions(List *ftoptons, Oid relid)
205{
206 ExtTableEntry *extentry;
207 ListCell *lc;
208 List *entryOptions = NIL;
209 char *arg;
210 bool rejectlimit_found = false;
211 bool rejectlimittype_found = false;
212 bool logerrors_found = false;
213 bool encoding_found = false;
214 bool iswritable_found = false;
215 bool executeon_found = false;
216
217 extentry = (ExtTableEntry *) palloc0(sizeof(ExtTableEntry));
218
219 foreach(lc, ftoptons)
220 {
221 DefElem *def = (DefElem *) lfirst(lc);
222
223 if (pg_strcasecmp(def->defname, "location_uris") == 0)
224 {
225 extentry->urilocations = TokenizeLocationUris(defGetString(def));
226 continue;
227 }
228
229 if (pg_strcasecmp(def->defname, "execute_on") == 0)
230 {
231 extentry->execlocations = list_make1(makeString(defGetString(def)));
232 executeon_found = true;
233 continue;
234 }
235
236 if (pg_strcasecmp(def->defname, "command") == 0)
237 {
238 extentry->command = defGetString(def);
239 continue;
240 }
241
242 if (pg_strcasecmp(def->defname, "format_type") == 0)
243 {
244 arg = defGetString(def);
245 extentry->fmtcode = arg[0];
246 continue;
247 }
248
249 /* only CSV format needs this for ProcessCopyOptions(), will do it later */
250 if (pg_strcasecmp(def->defname, "format") == 0)
251 {
252 continue;
253 }
254
255 if (pg_strcasecmp(def->defname, "reject_limit") == 0)
256 {
257 extentry->rejectlimit = atoi(defGetString(def));
258 rejectlimit_found = true;
259 continue;
260 }

Callers 2

GetExtTableEntryIfExistsFunction · 0.85
pg_exttableFunction · 0.85

Calls 11

pg_strcasecmpFunction · 0.85
TokenizeLocationUrisFunction · 0.85
defGetStringFunction · 0.85
makeStringFunction · 0.85
defGetBooleanFunction · 0.85
lappendFunction · 0.85
makeDefElemFunction · 0.85
GetDatabaseEncodingFunction · 0.85
palloc0Function · 0.50
foreachFunction · 0.50
pstrdupFunction · 0.50

Tested by

no test coverage detected