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

Function transformCreateExternalStmt

src/backend/parser/parse_utilcmd.c:2225–2402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2223}
2224
2225List *
2226transformCreateExternalStmt(CreateExternalStmt *stmt, const char *queryString)
2227{
2228 ParseState *pstate;
2229 CreateStmtContext cxt;
2230 List *result;
2231 ListCell *elements;
2232 DistributedBy *likeDistributedBy = NULL;
2233 bool bQuiet = false; /* shut up transformDistributedBy messages */
2234 bool iswritable = false;
2235
2236 /* Set up pstate */
2237 pstate = make_parsestate(NULL);
2238 pstate->p_sourcetext = queryString;
2239
2240 memset(&cxt, 0, sizeof(CreateStmtContext));
2241
2242 /*
2243 * Create a temporary context in order to confine memory leaks due
2244 * to expansions within a short lived context
2245 */
2246 cxt.tempCtx = AllocSetContextCreate(CurrentMemoryContext,
2247 "CreateExteranlStmt analyze context",
2248 ALLOCSET_DEFAULT_MINSIZE,
2249 ALLOCSET_DEFAULT_INITSIZE,
2250 ALLOCSET_DEFAULT_MAXSIZE);
2251
2252 /*
2253 * There exist transformations that might write on the passed on stmt.
2254 * Create a copy of it to both protect from (un)intentional writes and be
2255 * a bit more explicit of the intended ownership.
2256 */
2257 stmt = (CreateExternalStmt *)copyObject(stmt);
2258
2259 cxt.pstate = pstate;
2260 cxt.stmtType = "CREATE EXTERNAL TABLE";
2261 cxt.relation = stmt->relation;
2262 cxt.inhRelations = NIL;
2263 cxt.isalter = false;
2264 cxt.columns = NIL;
2265 cxt.ckconstraints = NIL;
2266 cxt.fkconstraints = NIL;
2267 cxt.ixconstraints = NIL;
2268 cxt.attr_encodings = NIL;
2269 cxt.pkey = NULL;
2270 cxt.rel = NULL;
2271
2272 cxt.blist = NIL;
2273 cxt.alist = NIL;
2274
2275 iswritable = stmt->iswritable;
2276
2277 /*
2278 * Run through each primary element in the table creation clause. Separate
2279 * column defs from constraints, and do preliminary analysis.
2280 */
2281 foreach(elements, stmt->tableElts)
2282 {

Callers 1

ProcessUtilitySlowFunction · 0.85

Calls 10

make_parsestateFunction · 0.85
transformTableLikeClauseFunction · 0.85
transformDistributedByFunction · 0.85
lappendFunction · 0.85
list_concatFunction · 0.85
foreachFunction · 0.50
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected