* build_simple_rel * Construct a new RelOptInfo for a base relation or 'other' relation. */
| 211 | * Construct a new RelOptInfo for a base relation or 'other' relation. |
| 212 | */ |
| 213 | RelOptInfo * |
| 214 | build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent) |
| 215 | { |
| 216 | RelOptInfo *rel; |
| 217 | RangeTblEntry *rte; |
| 218 | |
| 219 | /* Rel should not exist already */ |
| 220 | Assert(relid > 0 && relid < root->simple_rel_array_size); |
| 221 | if (root->simple_rel_array[relid] != NULL) |
| 222 | elog(ERROR, "rel %d already exists", relid); |
| 223 | |
| 224 | /* Fetch RTE for relation */ |
| 225 | rte = root->simple_rte_array[relid]; |
| 226 | Assert(rte != NULL); |
| 227 | |
| 228 | rel = makeNode(RelOptInfo); |
| 229 | rel->reloptkind = parent ? RELOPT_OTHER_MEMBER_REL : RELOPT_BASEREL; |
| 230 | rel->relids = bms_make_singleton(relid); |
| 231 | rel->rows = 0; |
| 232 | /* cheap startup cost is interesting iff not all tuples to be retrieved */ |
| 233 | rel->consider_startup = (root->tuple_fraction > 0); |
| 234 | rel->consider_param_startup = false; /* might get changed later */ |
| 235 | rel->consider_parallel = false; /* might get changed later */ |
| 236 | rel->reltarget = create_empty_pathtarget(); |
| 237 | rel->pathlist = NIL; |
| 238 | rel->ppilist = NIL; |
| 239 | rel->partial_pathlist = NIL; |
| 240 | rel->cheapest_startup_path = NULL; |
| 241 | rel->cheapest_total_path = NULL; |
| 242 | rel->cheapest_unique_path = NULL; |
| 243 | rel->cheapest_parameterized_paths = NIL; |
| 244 | rel->relid = relid; |
| 245 | rel->rtekind = rte->rtekind; |
| 246 | /* min_attr, max_attr, attr_needed, attr_widths are set below */ |
| 247 | rel->lateral_vars = NIL; |
| 248 | rel->indexlist = NIL; |
| 249 | rel->statlist = NIL; |
| 250 | rel->pages = 0; |
| 251 | rel->tuples = 0; |
| 252 | rel->allvisfrac = 0; |
| 253 | rel->eclass_indexes = NULL; |
| 254 | rel->subroot = NULL; |
| 255 | rel->subplan_params = NIL; |
| 256 | rel->rel_parallel_workers = -1; /* set up in get_relation_info */ |
| 257 | rel->amflags = 0; |
| 258 | rel->serverid = InvalidOid; |
| 259 | rel->segSeverids = NIL; |
| 260 | rel->userid = rte->checkAsUser; |
| 261 | rel->useridiscurrent = false; |
| 262 | rel->exec_location = FTEXECLOCATION_NOT_DEFINED; |
| 263 | rel->fdwroutine = NULL; |
| 264 | rel->fdw_private = NULL; |
| 265 | rel->unique_for_rels = NIL; |
| 266 | rel->non_unique_for_rels = NIL; |
| 267 | rel->baserestrictinfo = NIL; |
| 268 | rel->baserestrictcost.startup = 0; |
| 269 | rel->baserestrictcost.per_tuple = 0; |
| 270 | rel->baserestrict_min_security = UINT_MAX; |
no test coverage detected