From 54c04b9839d7e543720f2e1d73f9f20890ab1dce Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 28 Jun 2021 10:47:46 +0200 Subject: [PATCH] Remove redundant initializations Remove explicitly initializing structure fields to zero after the whole structure was already zeroed. Notably, makeNode() zeroes the structure automatically. In some cases it's worth keeping some explicit initializations for documentation or symmetry, but many of them are merely useless copy-and-paste. --- contrib/bloom/blutils.c | 24 -- contrib/postgres_fdw/postgres_fdw.c | 7 - src/backend/access/brin/brin.c | 23 -- src/backend/access/common/tupdesc.c | 10 - src/backend/access/gin/ginutil.c | 21 -- src/backend/access/gist/gist.c | 14 -- src/backend/access/hash/hash.c | 21 -- src/backend/access/spgist/spgutils.c | 17 -- src/backend/bootstrap/bootparse.y | 40 --- src/backend/catalog/index.c | 6 - src/backend/catalog/toasting.c | 12 - src/backend/commands/copy.c | 4 - src/backend/commands/copyfrom.c | 4 - src/backend/commands/copyto.c | 2 - src/backend/commands/createas.c | 4 - src/backend/commands/sequence.c | 14 -- src/backend/commands/tablecmds.c | 41 ---- src/backend/commands/typecmds.c | 10 - src/backend/commands/view.c | 11 +- src/backend/executor/execMain.c | 33 +-- src/backend/executor/execParallel.c | 11 - src/backend/executor/execUtils.c | 77 +----- src/backend/executor/nodeAgg.c | 15 -- src/backend/executor/nodeBitmapHeapscan.c | 17 -- src/backend/executor/nodeCtescan.c | 2 - src/backend/executor/nodeForeignscan.c | 1 - src/backend/executor/nodeHash.c | 1 - src/backend/executor/nodeIndexonlyscan.c | 11 - src/backend/executor/nodeIndexscan.c | 11 - src/backend/executor/nodeRecursiveunion.c | 7 - src/backend/executor/nodeSamplescan.c | 1 - src/backend/executor/nodeSubplan.c | 20 -- src/backend/nodes/makefuncs.c | 44 ---- src/backend/optimizer/plan/planner.c | 47 ---- src/backend/optimizer/plan/subselect.c | 13 - src/backend/optimizer/prep/prepjointree.c | 21 -- src/backend/optimizer/util/relnode.c | 148 ----------- src/backend/optimizer/util/restrictinfo.c | 20 +- src/backend/parser/analyze.c | 3 - src/backend/parser/gram.y | 284 ---------------------- src/backend/parser/parse_clause.c | 2 - src/backend/parser/parse_expr.c | 2 - src/backend/parser/parse_relation.c | 86 +------ src/backend/parser/parse_utilcmd.c | 55 ----- src/backend/utils/adt/ruleutils.c | 9 - src/backend/utils/cache/plancache.c | 47 ---- src/backend/utils/cache/relcache.c | 45 ---- src/include/nodes/primnodes.h | 2 +- 48 files changed, 7 insertions(+), 1313 deletions(-) diff --git a/contrib/bloom/blutils.c b/contrib/bloom/blutils.c index 754de008d4..927c8458df 100644 --- a/contrib/bloom/blutils.c +++ b/contrib/bloom/blutils.c @@ -110,46 +110,22 @@ blhandler(PG_FUNCTION_ARGS) amroutine->amstrategies = BLOOM_NSTRATEGIES; amroutine->amsupport = BLOOM_NPROC; amroutine->amoptsprocnum = BLOOM_OPTIONS_PROC; - amroutine->amcanorder = false; - amroutine->amcanorderbyop = false; - amroutine->amcanbackward = false; - amroutine->amcanunique = false; amroutine->amcanmulticol = true; amroutine->amoptionalkey = true; - amroutine->amsearcharray = false; - amroutine->amsearchnulls = false; - amroutine->amstorage = false; - amroutine->amclusterable = false; - amroutine->ampredlocks = false; - amroutine->amcanparallel = false; - amroutine->amcaninclude = false; - amroutine->amusemaintenanceworkmem = false; amroutine->amparallelvacuumoptions = VACUUM_OPTION_PARALLEL_BULKDEL | VACUUM_OPTION_PARALLEL_CLEANUP; - amroutine->amkeytype = InvalidOid; - amroutine->ambuild = blbuild; amroutine->ambuildempty = blbuildempty; amroutine->aminsert = blinsert; amroutine->ambulkdelete = blbulkdelete; amroutine->amvacuumcleanup = blvacuumcleanup; - amroutine->amcanreturn = NULL; amroutine->amcostestimate = blcostestimate; amroutine->amoptions = bloptions; - amroutine->amproperty = NULL; - amroutine->ambuildphasename = NULL; amroutine->amvalidate = blvalidate; - amroutine->amadjustmembers = NULL; amroutine->ambeginscan = blbeginscan; amroutine->amrescan = blrescan; - amroutine->amgettuple = NULL; amroutine->amgetbitmap = blgetbitmap; amroutine->amendscan = blendscan; - amroutine->ammarkpos = NULL; - amroutine->amrestrpos = NULL; - amroutine->amestimateparallelscan = NULL; - amroutine->aminitparallelscan = NULL; - amroutine->amparallelrescan = NULL; PG_RETURN_POINTER(amroutine); } diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index fafbab6b02..b0fb649f0c 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -672,8 +672,6 @@ postgresGetForeignRelSize(PlannerInfo *root, fpinfo->user = GetUserMapping(userid, fpinfo->server->serverid); } - else - fpinfo->user = NULL; /* * Identify which baserestrictinfo clauses can be sent to the remote @@ -690,7 +688,6 @@ postgresGetForeignRelSize(PlannerInfo *root, * sent to the remote and thus we wouldn't really need to retrieve the * columns used in them. Doesn't seem worth detecting that case though.) */ - fpinfo->attrs_used = NULL; pull_varattnos((Node *) baserel->reltarget->exprs, baserel->relid, &fpinfo->attrs_used); foreach(lc, fpinfo->local_conds) @@ -779,10 +776,6 @@ postgresGetForeignRelSize(PlannerInfo *root, */ fpinfo->relation_name = psprintf("%u", baserel->relid); - /* No outer and inner relations. */ - fpinfo->make_outerrel_subquery = false; - fpinfo->make_innerrel_subquery = false; - fpinfo->lower_subquery_rels = NULL; /* Set the relation index. */ fpinfo->relation_index = baserel->relid; } diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c index ccc9fa0959..ac89464bc1 100644 --- a/src/backend/access/brin/brin.c +++ b/src/backend/access/brin/brin.c @@ -91,49 +91,26 @@ brinhandler(PG_FUNCTION_ARGS) { IndexAmRoutine *amroutine = makeNode(IndexAmRoutine); - amroutine->amstrategies = 0; amroutine->amsupport = BRIN_LAST_OPTIONAL_PROCNUM; amroutine->amoptsprocnum = BRIN_PROCNUM_OPTIONS; - amroutine->amcanorder = false; - amroutine->amcanorderbyop = false; - amroutine->amcanbackward = false; - amroutine->amcanunique = false; amroutine->amcanmulticol = true; amroutine->amoptionalkey = true; - amroutine->amsearcharray = false; amroutine->amsearchnulls = true; amroutine->amstorage = true; - amroutine->amclusterable = false; - amroutine->ampredlocks = false; - amroutine->amcanparallel = false; - amroutine->amcaninclude = false; - amroutine->amusemaintenanceworkmem = false; amroutine->amparallelvacuumoptions = VACUUM_OPTION_PARALLEL_CLEANUP; - amroutine->amkeytype = InvalidOid; - amroutine->ambuild = brinbuild; amroutine->ambuildempty = brinbuildempty; amroutine->aminsert = brininsert; amroutine->ambulkdelete = brinbulkdelete; amroutine->amvacuumcleanup = brinvacuumcleanup; - amroutine->amcanreturn = NULL; amroutine->amcostestimate = brincostestimate; amroutine->amoptions = brinoptions; - amroutine->amproperty = NULL; - amroutine->ambuildphasename = NULL; amroutine->amvalidate = brinvalidate; - amroutine->amadjustmembers = NULL; amroutine->ambeginscan = brinbeginscan; amroutine->amrescan = brinrescan; - amroutine->amgettuple = NULL; amroutine->amgetbitmap = bringetbitmap; amroutine->amendscan = brinendscan; - amroutine->ammarkpos = NULL; - amroutine->amrestrpos = NULL; - amroutine->amestimateparallelscan = NULL; - amroutine->aminitparallelscan = NULL; - amroutine->amparallelrescan = NULL; PG_RETURN_POINTER(amroutine); } diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index 4c63bd4dc6..8f8c213937 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -846,18 +846,8 @@ BuildDescForRelation(List *schema) TupleConstr *constr = (TupleConstr *) palloc0(sizeof(TupleConstr)); constr->has_not_null = true; - constr->has_generated_stored = false; - constr->defval = NULL; - constr->missing = NULL; - constr->num_defval = 0; - constr->check = NULL; - constr->num_check = 0; desc->constr = constr; } - else - { - desc->constr = NULL; - } return desc; } diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c index cdd626ff0a..87b7af5aab 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -39,49 +39,28 @@ ginhandler(PG_FUNCTION_ARGS) { IndexAmRoutine *amroutine = makeNode(IndexAmRoutine); - amroutine->amstrategies = 0; amroutine->amsupport = GINNProcs; amroutine->amoptsprocnum = GIN_OPTIONS_PROC; - amroutine->amcanorder = false; - amroutine->amcanorderbyop = false; - amroutine->amcanbackward = false; - amroutine->amcanunique = false; amroutine->amcanmulticol = true; amroutine->amoptionalkey = true; - amroutine->amsearcharray = false; - amroutine->amsearchnulls = false; amroutine->amstorage = true; - amroutine->amclusterable = false; amroutine->ampredlocks = true; - amroutine->amcanparallel = false; - amroutine->amcaninclude = false; amroutine->amusemaintenanceworkmem = true; amroutine->amparallelvacuumoptions = VACUUM_OPTION_PARALLEL_BULKDEL | VACUUM_OPTION_PARALLEL_CLEANUP; - amroutine->amkeytype = InvalidOid; - amroutine->ambuild = ginbuild; amroutine->ambuildempty = ginbuildempty; amroutine->aminsert = gininsert; amroutine->ambulkdelete = ginbulkdelete; amroutine->amvacuumcleanup = ginvacuumcleanup; - amroutine->amcanreturn = NULL; amroutine->amcostestimate = gincostestimate; amroutine->amoptions = ginoptions; - amroutine->amproperty = NULL; - amroutine->ambuildphasename = NULL; amroutine->amvalidate = ginvalidate; amroutine->amadjustmembers = ginadjustmembers; amroutine->ambeginscan = ginbeginscan; amroutine->amrescan = ginrescan; - amroutine->amgettuple = NULL; amroutine->amgetbitmap = gingetbitmap; amroutine->amendscan = ginendscan; - amroutine->ammarkpos = NULL; - amroutine->amrestrpos = NULL; - amroutine->amestimateparallelscan = NULL; - amroutine->aminitparallelscan = NULL; - amroutine->amparallelrescan = NULL; PG_RETURN_POINTER(amroutine); } diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 0683f42c25..37f2eb6459 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -60,27 +60,18 @@ gisthandler(PG_FUNCTION_ARGS) { IndexAmRoutine *amroutine = makeNode(IndexAmRoutine); - amroutine->amstrategies = 0; amroutine->amsupport = GISTNProcs; amroutine->amoptsprocnum = GIST_OPTIONS_PROC; - amroutine->amcanorder = false; amroutine->amcanorderbyop = true; - amroutine->amcanbackward = false; - amroutine->amcanunique = false; amroutine->amcanmulticol = true; amroutine->amoptionalkey = true; - amroutine->amsearcharray = false; amroutine->amsearchnulls = true; amroutine->amstorage = true; amroutine->amclusterable = true; amroutine->ampredlocks = true; - amroutine->amcanparallel = false; amroutine->amcaninclude = true; - amroutine->amusemaintenanceworkmem = false; amroutine->amparallelvacuumoptions = VACUUM_OPTION_PARALLEL_BULKDEL | VACUUM_OPTION_PARALLEL_COND_CLEANUP; - amroutine->amkeytype = InvalidOid; - amroutine->ambuild = gistbuild; amroutine->ambuildempty = gistbuildempty; amroutine->aminsert = gistinsert; @@ -98,11 +89,6 @@ gisthandler(PG_FUNCTION_ARGS) amroutine->amgettuple = gistgettuple; amroutine->amgetbitmap = gistgetbitmap; amroutine->amendscan = gistendscan; - amroutine->ammarkpos = NULL; - amroutine->amrestrpos = NULL; - amroutine->amestimateparallelscan = NULL; - amroutine->aminitparallelscan = NULL; - amroutine->amparallelrescan = NULL; PG_RETURN_POINTER(amroutine); } diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c index 0752fb38a9..50c1f5bc82 100644 --- a/src/backend/access/hash/hash.c +++ b/src/backend/access/hash/hash.c @@ -60,34 +60,18 @@ hashhandler(PG_FUNCTION_ARGS) amroutine->amstrategies = HTMaxStrategyNumber; amroutine->amsupport = HASHNProcs; amroutine->amoptsprocnum = HASHOPTIONS_PROC; - amroutine->amcanorder = false; - amroutine->amcanorderbyop = false; amroutine->amcanbackward = true; - amroutine->amcanunique = false; - amroutine->amcanmulticol = false; - amroutine->amoptionalkey = false; - amroutine->amsearcharray = false; - amroutine->amsearchnulls = false; - amroutine->amstorage = false; - amroutine->amclusterable = false; amroutine->ampredlocks = true; - amroutine->amcanparallel = false; - amroutine->amcaninclude = false; - amroutine->amusemaintenanceworkmem = false; amroutine->amparallelvacuumoptions = VACUUM_OPTION_PARALLEL_BULKDEL; amroutine->amkeytype = INT4OID; - amroutine->ambuild = hashbuild; amroutine->ambuildempty = hashbuildempty; amroutine->aminsert = hashinsert; amroutine->ambulkdelete = hashbulkdelete; amroutine->amvacuumcleanup = hashvacuumcleanup; - amroutine->amcanreturn = NULL; amroutine->amcostestimate = hashcostestimate; amroutine->amoptions = hashoptions; - amroutine->amproperty = NULL; - amroutine->ambuildphasename = NULL; amroutine->amvalidate = hashvalidate; amroutine->amadjustmembers = hashadjustmembers; amroutine->ambeginscan = hashbeginscan; @@ -95,11 +79,6 @@ hashhandler(PG_FUNCTION_ARGS) amroutine->amgettuple = hashgettuple; amroutine->amgetbitmap = hashgetbitmap; amroutine->amendscan = hashendscan; - amroutine->ammarkpos = NULL; - amroutine->amrestrpos = NULL; - amroutine->amestimateparallelscan = NULL; - amroutine->aminitparallelscan = NULL; - amroutine->amparallelrescan = NULL; PG_RETURN_POINTER(amroutine); } diff --git a/src/backend/access/spgist/spgutils.c b/src/backend/access/spgist/spgutils.c index 9ff280a252..0de8d42736 100644 --- a/src/backend/access/spgist/spgutils.c +++ b/src/backend/access/spgist/spgutils.c @@ -44,27 +44,15 @@ spghandler(PG_FUNCTION_ARGS) { IndexAmRoutine *amroutine = makeNode(IndexAmRoutine); - amroutine->amstrategies = 0; amroutine->amsupport = SPGISTNProc; amroutine->amoptsprocnum = SPGIST_OPTIONS_PROC; - amroutine->amcanorder = false; amroutine->amcanorderbyop = true; - amroutine->amcanbackward = false; - amroutine->amcanunique = false; - amroutine->amcanmulticol = false; amroutine->amoptionalkey = true; - amroutine->amsearcharray = false; amroutine->amsearchnulls = true; amroutine->amstorage = true; - amroutine->amclusterable = false; - amroutine->ampredlocks = false; - amroutine->amcanparallel = false; amroutine->amcaninclude = true; - amroutine->amusemaintenanceworkmem = false; amroutine->amparallelvacuumoptions = VACUUM_OPTION_PARALLEL_BULKDEL | VACUUM_OPTION_PARALLEL_COND_CLEANUP; - amroutine->amkeytype = InvalidOid; - amroutine->ambuild = spgbuild; amroutine->ambuildempty = spgbuildempty; amroutine->aminsert = spginsert; @@ -82,11 +70,6 @@ spghandler(PG_FUNCTION_ARGS) amroutine->amgettuple = spggettuple; amroutine->amgetbitmap = spggetbitmap; amroutine->amendscan = spgendscan; - amroutine->ammarkpos = NULL; - amroutine->amrestrpos = NULL; - amroutine->amestimateparallelscan = NULL; - amroutine->aminitparallelscan = NULL; - amroutine->amparallelrescan = NULL; PG_RETURN_POINTER(amroutine); } diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 5fcd004e1b..5e9349e6a1 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -278,26 +278,7 @@ Boot_DeclareIndexStmt: stmt->idxname = $3; stmt->relation = makeRangeVar(NULL, $6, -1); stmt->accessMethod = $8; - stmt->tableSpace = NULL; stmt->indexParams = $10; - stmt->indexIncludingParams = NIL; - stmt->options = NIL; - stmt->whereClause = NULL; - stmt->excludeOpNames = NIL; - stmt->idxcomment = NULL; - stmt->indexOid = InvalidOid; - stmt->oldNode = InvalidOid; - stmt->oldCreateSubid = InvalidSubTransactionId; - stmt->oldFirstRelfilenodeSubid = InvalidSubTransactionId; - stmt->unique = false; - stmt->primary = false; - stmt->isconstraint = false; - stmt->deferrable = false; - stmt->initdeferred = false; - stmt->transformed = false; - stmt->concurrent = false; - stmt->if_not_exists = false; - stmt->reset_default_tblspc = false; /* locks and races need not concern us in bootstrap mode */ relationId = RangeVarGetRelid(stmt->relation, NoLock, @@ -330,26 +311,8 @@ Boot_DeclareUniqueIndexStmt: stmt->idxname = $4; stmt->relation = makeRangeVar(NULL, $7, -1); stmt->accessMethod = $9; - stmt->tableSpace = NULL; stmt->indexParams = $11; - stmt->indexIncludingParams = NIL; - stmt->options = NIL; - stmt->whereClause = NULL; - stmt->excludeOpNames = NIL; - stmt->idxcomment = NULL; - stmt->indexOid = InvalidOid; - stmt->oldNode = InvalidOid; - stmt->oldCreateSubid = InvalidSubTransactionId; - stmt->oldFirstRelfilenodeSubid = InvalidSubTransactionId; stmt->unique = true; - stmt->primary = false; - stmt->isconstraint = false; - stmt->deferrable = false; - stmt->initdeferred = false; - stmt->transformed = false; - stmt->concurrent = false; - stmt->if_not_exists = false; - stmt->reset_default_tblspc = false; /* locks and races need not concern us in bootstrap mode */ relationId = RangeVarGetRelid(stmt->relation, NoLock, @@ -401,9 +364,6 @@ boot_index_param: { IndexElem *n = makeNode(IndexElem); n->name = $1; - n->expr = NULL; - n->indexcolname = NULL; - n->collation = NIL; n->opclass = list_make1(makeString($2)); n->ordering = SORTBY_DEFAULT; n->nulls_ordering = SORTBY_NULLS_DEFAULT; diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 50b7a16bce..1300bb61b4 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -2007,18 +2007,12 @@ index_constraint_create(Relation heapRelation, trigger->trigname = (constraintType == CONSTRAINT_PRIMARY) ? "PK_ConstraintTrigger" : "Unique_ConstraintTrigger"; - trigger->relation = NULL; trigger->funcname = SystemFuncName("unique_key_recheck"); - trigger->args = NIL; trigger->row = true; trigger->timing = TRIGGER_TYPE_AFTER; trigger->events = TRIGGER_TYPE_INSERT | TRIGGER_TYPE_UPDATE; - trigger->columns = NIL; - trigger->whenClause = NULL; - trigger->transitionRels = NIL; trigger->deferrable = true; trigger->initdeferred = initdeferred; - trigger->constrrel = NULL; (void) CreateTrigger(trigger, NULL, RelationGetRelid(heapRelation), InvalidOid, conOid, indexRelationId, InvalidOid, diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c index bf81f6ccc5..ef9e71849a 100644 --- a/src/backend/catalog/toasting.c +++ b/src/backend/catalog/toasting.c @@ -287,21 +287,9 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, indexInfo->ii_NumIndexKeyAttrs = 2; indexInfo->ii_IndexAttrNumbers[0] = 1; indexInfo->ii_IndexAttrNumbers[1] = 2; - indexInfo->ii_Expressions = NIL; - indexInfo->ii_ExpressionsState = NIL; - indexInfo->ii_Predicate = NIL; - indexInfo->ii_PredicateState = NULL; - indexInfo->ii_ExclusionOps = NULL; - indexInfo->ii_ExclusionProcs = NULL; - indexInfo->ii_ExclusionStrats = NULL; - indexInfo->ii_OpclassOptions = NULL; indexInfo->ii_Unique = true; indexInfo->ii_ReadyForInserts = true; - indexInfo->ii_Concurrent = false; - indexInfo->ii_BrokenHotChain = false; - indexInfo->ii_ParallelWorkers = 0; indexInfo->ii_Am = BTREE_AM_OID; - indexInfo->ii_AmCache = NULL; indexInfo->ii_Context = CurrentMemoryContext; collationObjectId[0] = InvalidOid; diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 8265b981eb..0bdbd592cb 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -207,8 +207,6 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt, cr->location = -1; target = makeNode(ResTarget); - target->name = NULL; - target->indirection = NIL; target->val = (Node *) cr; target->location = -1; @@ -232,8 +230,6 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt, /* Build the ResTarget and add the ColumnRef to it. */ target = makeNode(ResTarget); - target->name = NULL; - target->indirection = NIL; target->val = (Node *) cr; target->location = -1; diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c index 40a54ad0bd..42175b6208 100644 --- a/src/backend/commands/copyfrom.c +++ b/src/backend/commands/copyfrom.c @@ -664,7 +664,6 @@ CopyFrom(CopyFromState cstate) * foreign-table result relation(s). */ mtstate = makeNode(ModifyTableState); - mtstate->ps.plan = NULL; mtstate->ps.state = estate; mtstate->operation = CMD_INSERT; mtstate->mt_nrels = 1; @@ -1347,9 +1346,6 @@ BeginCopyFrom(ParseState *pstate, /* Initialize state variables */ cstate->eol_type = EOL_UNKNOWN; cstate->cur_relname = RelationGetRelationName(cstate->rel); - cstate->cur_lineno = 0; - cstate->cur_attname = NULL; - cstate->cur_attval = NULL; /* * Allocate buffers for the input pipeline. diff --git a/src/backend/commands/copyto.c b/src/backend/commands/copyto.c index b6eacd5baa..c590475cb1 100644 --- a/src/backend/commands/copyto.c +++ b/src/backend/commands/copyto.c @@ -433,8 +433,6 @@ BeginCopyTo(ParseState *pstate, PlannedStmt *plan; DestReceiver *dest; - cstate->rel = NULL; - /* * Run parse analysis and rewrite. Note this also acquires sufficient * locks on the source table(s). diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c index 0982851715..e0ff23fc55 100644 --- a/src/backend/commands/createas.c +++ b/src/backend/commands/createas.c @@ -101,13 +101,9 @@ create_ctas_internal(List *attrList, IntoClause *into) */ create->relation = into->rel; create->tableElts = attrList; - create->inhRelations = NIL; - create->ofTypename = NULL; - create->constraints = NIL; create->options = into->options; create->oncommit = into->onCommit; create->tablespacename = into->tableSpaceName; - create->if_not_exists = false; create->accessMethod = into->accessMethod; /* diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 0415df9ccb..0f88d13634 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -165,21 +165,12 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq) /* * Create relation (and fill value[] and null[] for the tuple) */ - stmt->tableElts = NIL; for (i = SEQ_COL_FIRSTCOL; i <= SEQ_COL_LASTCOL; i++) { ColumnDef *coldef = makeNode(ColumnDef); - coldef->inhcount = 0; coldef->is_local = true; coldef->is_not_null = true; - coldef->is_from_type = false; - coldef->storage = 0; - coldef->raw_default = NULL; - coldef->cooked_default = NULL; - coldef->collClause = NULL; - coldef->collOid = InvalidOid; - coldef->constraints = NIL; coldef->location = -1; null[i - 1] = false; @@ -206,11 +197,6 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq) } stmt->relation = seq->sequence; - stmt->inhRelations = NIL; - stmt->constraints = NIL; - stmt->options = NIL; - stmt->oncommit = ONCOMMIT_NOOP; - stmt->tablespacename = NULL; stmt->if_not_exists = seq->if_not_exists; address = DefineRelation(stmt, RELKIND_SEQUENCE, seq->ownerId, NULL, NULL); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 97a9725df7..6f2b543ed5 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -2620,16 +2620,10 @@ MergeAttributes(List *schema, List *supers, char relpersistence, def->typeName = makeTypeNameFromOid(attribute->atttypid, attribute->atttypmod); def->inhcount = 1; - def->is_local = false; def->is_not_null = attribute->attnotnull; - def->is_from_type = false; def->storage = attribute->attstorage; - def->raw_default = NULL; - def->cooked_default = NULL; def->generated = attribute->attgenerated; - def->collClause = NULL; def->collOid = attribute->attcollation; - def->constraints = NIL; def->location = -1; if (CompressionMethodIsValid(attribute->attcompression)) def->compression = @@ -11092,7 +11086,6 @@ CreateFKCheckTrigger(Oid myRelOid, Oid refRelOid, Constraint *fkconstraint, fk_trigger->replace = false; fk_trigger->isconstraint = true; fk_trigger->trigname = "RI_ConstraintTrigger_c"; - fk_trigger->relation = NULL; /* Either ON INSERT or ON UPDATE */ if (on_insert) @@ -11106,15 +11099,10 @@ CreateFKCheckTrigger(Oid myRelOid, Oid refRelOid, Constraint *fkconstraint, fk_trigger->events = TRIGGER_TYPE_UPDATE; } - fk_trigger->args = NIL; fk_trigger->row = true; fk_trigger->timing = TRIGGER_TYPE_AFTER; - fk_trigger->columns = NIL; - fk_trigger->whenClause = NULL; - fk_trigger->transitionRels = NIL; fk_trigger->deferrable = fkconstraint->deferrable; fk_trigger->initdeferred = fkconstraint->initdeferred; - fk_trigger->constrrel = NULL; (void) CreateTrigger(fk_trigger, NULL, myRelOid, refRelOid, constraintOid, indexOid, InvalidOid, InvalidOid, NULL, true, false); @@ -11142,15 +11130,9 @@ createForeignKeyActionTriggers(Relation rel, Oid refRelOid, Constraint *fkconstr fk_trigger->replace = false; fk_trigger->isconstraint = true; fk_trigger->trigname = "RI_ConstraintTrigger_a"; - fk_trigger->relation = NULL; - fk_trigger->args = NIL; fk_trigger->row = true; fk_trigger->timing = TRIGGER_TYPE_AFTER; fk_trigger->events = TRIGGER_TYPE_DELETE; - fk_trigger->columns = NIL; - fk_trigger->whenClause = NULL; - fk_trigger->transitionRels = NIL; - fk_trigger->constrrel = NULL; switch (fkconstraint->fk_del_action) { case FKCONSTR_ACTION_NOACTION: @@ -11159,23 +11141,15 @@ createForeignKeyActionTriggers(Relation rel, Oid refRelOid, Constraint *fkconstr fk_trigger->funcname = SystemFuncName("RI_FKey_noaction_del"); break; case FKCONSTR_ACTION_RESTRICT: - fk_trigger->deferrable = false; - fk_trigger->initdeferred = false; fk_trigger->funcname = SystemFuncName("RI_FKey_restrict_del"); break; case FKCONSTR_ACTION_CASCADE: - fk_trigger->deferrable = false; - fk_trigger->initdeferred = false; fk_trigger->funcname = SystemFuncName("RI_FKey_cascade_del"); break; case FKCONSTR_ACTION_SETNULL: - fk_trigger->deferrable = false; - fk_trigger->initdeferred = false; fk_trigger->funcname = SystemFuncName("RI_FKey_setnull_del"); break; case FKCONSTR_ACTION_SETDEFAULT: - fk_trigger->deferrable = false; - fk_trigger->initdeferred = false; fk_trigger->funcname = SystemFuncName("RI_FKey_setdefault_del"); break; default: @@ -11199,15 +11173,9 @@ createForeignKeyActionTriggers(Relation rel, Oid refRelOid, Constraint *fkconstr fk_trigger->replace = false; fk_trigger->isconstraint = true; fk_trigger->trigname = "RI_ConstraintTrigger_a"; - fk_trigger->relation = NULL; - fk_trigger->args = NIL; fk_trigger->row = true; fk_trigger->timing = TRIGGER_TYPE_AFTER; fk_trigger->events = TRIGGER_TYPE_UPDATE; - fk_trigger->columns = NIL; - fk_trigger->whenClause = NULL; - fk_trigger->transitionRels = NIL; - fk_trigger->constrrel = NULL; switch (fkconstraint->fk_upd_action) { case FKCONSTR_ACTION_NOACTION: @@ -11216,23 +11184,15 @@ createForeignKeyActionTriggers(Relation rel, Oid refRelOid, Constraint *fkconstr fk_trigger->funcname = SystemFuncName("RI_FKey_noaction_upd"); break; case FKCONSTR_ACTION_RESTRICT: - fk_trigger->deferrable = false; - fk_trigger->initdeferred = false; fk_trigger->funcname = SystemFuncName("RI_FKey_restrict_upd"); break; case FKCONSTR_ACTION_CASCADE: - fk_trigger->deferrable = false; - fk_trigger->initdeferred = false; fk_trigger->funcname = SystemFuncName("RI_FKey_cascade_upd"); break; case FKCONSTR_ACTION_SETNULL: - fk_trigger->deferrable = false; - fk_trigger->initdeferred = false; fk_trigger->funcname = SystemFuncName("RI_FKey_setnull_upd"); break; case FKCONSTR_ACTION_SETDEFAULT: - fk_trigger->deferrable = false; - fk_trigger->initdeferred = false; fk_trigger->funcname = SystemFuncName("RI_FKey_setdefault_upd"); break; default: @@ -17619,7 +17579,6 @@ CloneRowTriggersToPartition(Relation parent, Relation partition) trigStmt->replace = false; trigStmt->isconstraint = OidIsValid(trigForm->tgconstraint); trigStmt->trigname = NameStr(trigForm->tgname); - trigStmt->relation = NULL; trigStmt->funcname = NULL; /* passed separately */ trigStmt->args = trigargs; trigStmt->row = true; diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 58ec65c6af..ebeecf3530 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -2529,18 +2529,8 @@ DefineCompositeType(RangeVar *typevar, List *coldeflist) Oid typeNamespace; ObjectAddress address; - /* - * now set the parameters for keys/inheritance etc. All of these are - * uninteresting for composite types... - */ createStmt->relation = typevar; createStmt->tableElts = coldeflist; - createStmt->inhRelations = NIL; - createStmt->constraints = NIL; - createStmt->options = NIL; - createStmt->oncommit = ONCOMMIT_NOOP; - createStmt->tablespacename = NULL; - createStmt->if_not_exists = false; /* * Check for collision with an existing type name. If there is one and diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index 4df05a0b33..da6db63590 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -52,7 +52,6 @@ DefineVirtualRelation(RangeVar *relation, List *tlist, bool replace, { Oid viewOid; LOCKMODE lockmode; - CreateStmt *createStmt = makeNode(CreateStmt); List *attrList; ListCell *t; @@ -214,20 +213,12 @@ DefineVirtualRelation(RangeVar *relation, List *tlist, bool replace, } else { + CreateStmt *createStmt = makeNode(CreateStmt); ObjectAddress address; - /* - * Set the parameters for keys/inheritance etc. All of these are - * uninteresting for views... - */ createStmt->relation = relation; createStmt->tableElts = attrList; - createStmt->inhRelations = NIL; - createStmt->constraints = NIL; createStmt->options = options; - createStmt->oncommit = ONCOMMIT_NOOP; - createStmt->tablespacename = NULL; - createStmt->if_not_exists = false; /* * Create the relation (this will error out if there's an existing diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index b3ce4bae53..4fec8290ff 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1200,9 +1200,6 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo, resultRelInfo->type = T_ResultRelInfo; resultRelInfo->ri_RangeTableIndex = resultRelationIndex; resultRelInfo->ri_RelationDesc = resultRelationDesc; - resultRelInfo->ri_NumIndices = 0; - resultRelInfo->ri_IndexRelationDescs = NULL; - resultRelInfo->ri_IndexRelationInfo = NULL; /* make a copy so as not to depend on relcache info not changing... */ resultRelInfo->ri_TrigDesc = CopyTriggerDesc(resultRelationDesc->trigdesc); if (resultRelInfo->ri_TrigDesc) @@ -1216,33 +1213,10 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo, if (instrument_options) resultRelInfo->ri_TrigInstrument = InstrAlloc(n, instrument_options, false); } - else - { - resultRelInfo->ri_TrigFunctions = NULL; - resultRelInfo->ri_TrigWhenExprs = NULL; - resultRelInfo->ri_TrigInstrument = NULL; - } if (resultRelationDesc->rd_rel->relkind == RELKIND_FOREIGN_TABLE) resultRelInfo->ri_FdwRoutine = GetFdwRoutineForRelation(resultRelationDesc, true); - else - resultRelInfo->ri_FdwRoutine = NULL; - - /* The following fields are set later if needed */ - resultRelInfo->ri_RowIdAttNo = 0; - resultRelInfo->ri_projectNew = NULL; - resultRelInfo->ri_newTupleSlot = NULL; - resultRelInfo->ri_oldTupleSlot = NULL; - resultRelInfo->ri_projectNewInfoValid = false; - resultRelInfo->ri_FdwState = NULL; - resultRelInfo->ri_usesFdwDirectModify = false; - resultRelInfo->ri_ConstraintExprs = NULL; - resultRelInfo->ri_GeneratedExprs = NULL; - resultRelInfo->ri_projectReturning = NULL; - resultRelInfo->ri_onConflictArbiterIndexes = NIL; - resultRelInfo->ri_onConflict = NULL; - resultRelInfo->ri_ReturningSlot = NULL; - resultRelInfo->ri_TrigOldSlot = NULL; - resultRelInfo->ri_TrigNewSlot = NULL; + + /* Other fields are set later if needed */ /* * Only ExecInitPartitionInfo() and ExecInitPartitionDispatchInfo() pass @@ -1254,9 +1228,6 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo, resultRelInfo->ri_RootToPartitionMap = NULL; /* set by * ExecInitRoutingInfo */ resultRelInfo->ri_PartitionTupleSlot = NULL; /* ditto */ - resultRelInfo->ri_ChildToRootMap = NULL; - resultRelInfo->ri_ChildToRootMapValid = false; - resultRelInfo->ri_CopyMultiInsertBuffer = NULL; } /* diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index 12c41d746b..b30872e47f 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -176,16 +176,9 @@ ExecSerializePlan(Plan *plan, EState *estate) pstmt = makeNode(PlannedStmt); pstmt->commandType = CMD_SELECT; pstmt->queryId = pgstat_get_my_query_id(); - pstmt->hasReturning = false; - pstmt->hasModifyingCTE = false; pstmt->canSetTag = true; - pstmt->transientPlan = false; - pstmt->dependsOnRole = false; - pstmt->parallelModeNeeded = false; pstmt->planTree = plan; pstmt->rtable = estate->es_range_table; - pstmt->resultRelations = NIL; - pstmt->appendRelations = NIL; /* * Transfer only parallel-safe subplans, leaving a NULL "hole" in the list @@ -204,12 +197,8 @@ ExecSerializePlan(Plan *plan, EState *estate) pstmt->subplans = lappend(pstmt->subplans, subplan); } - pstmt->rewindPlanIDs = NULL; - pstmt->rowMarks = NIL; - pstmt->relationOids = NIL; pstmt->invalItems = NIL; /* workers can't replan anyway... */ pstmt->paramExecTypes = estate->es_plannedstmt->paramExecTypes; - pstmt->utilityStmt = NULL; pstmt->stmt_location = -1; pstmt->stmt_len = -1; diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index ad11392b99..dffa16a8ee 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -107,61 +107,11 @@ CreateExecutorState(void) oldcontext = MemoryContextSwitchTo(qcontext); estate = makeNode(EState); - - /* - * Initialize all fields of the Executor State structure - */ - estate->es_direction = ForwardScanDirection; estate->es_snapshot = InvalidSnapshot; /* caller must initialize this */ estate->es_crosscheck_snapshot = InvalidSnapshot; /* no crosscheck */ - estate->es_range_table = NIL; - estate->es_range_table_size = 0; - estate->es_relations = NULL; - estate->es_rowmarks = NULL; - estate->es_plannedstmt = NULL; - - estate->es_junkFilter = NULL; - - estate->es_output_cid = (CommandId) 0; - - estate->es_result_relations = NULL; - estate->es_opened_result_relations = NIL; - estate->es_tuple_routing_result_relations = NIL; - estate->es_trig_target_relations = NIL; - - estate->es_param_list_info = NULL; - estate->es_param_exec_vals = NULL; - - estate->es_queryEnv = NULL; - + estate->es_direction = ForwardScanDirection; estate->es_query_cxt = qcontext; - estate->es_tupleTable = NIL; - - estate->es_processed = 0; - - estate->es_top_eflags = 0; - estate->es_instrument = 0; - estate->es_finished = false; - - estate->es_exprcontexts = NIL; - - estate->es_subplanstates = NIL; - - estate->es_auxmodifytables = NIL; - - estate->es_per_tuple_exprcontext = NULL; - - estate->es_sourceText = NULL; - - estate->es_use_parallel_mode = false; - - estate->es_jit_flags = 0; - estate->es_jit = NULL; - - /* - * Return the executor state structure - */ MemoryContextSwitchTo(oldcontext); return estate; @@ -239,11 +189,6 @@ CreateExprContextInternal(EState *estate, Size minContextSize, econtext = makeNode(ExprContext); - /* Initialize fields of ExprContext */ - econtext->ecxt_scantuple = NULL; - econtext->ecxt_innertuple = NULL; - econtext->ecxt_outertuple = NULL; - econtext->ecxt_per_query_memory = estate->es_query_cxt; /* @@ -259,9 +204,6 @@ CreateExprContextInternal(EState *estate, Size minContextSize, econtext->ecxt_param_exec_vals = estate->es_param_exec_vals; econtext->ecxt_param_list_info = estate->es_param_list_info; - econtext->ecxt_aggvalues = NULL; - econtext->ecxt_aggnulls = NULL; - econtext->caseValue_datum = (Datum) 0; econtext->caseValue_isNull = true; @@ -270,8 +212,6 @@ CreateExprContextInternal(EState *estate, Size minContextSize, econtext->ecxt_estate = estate; - econtext->ecxt_callbacks = NULL; - /* * Link the ExprContext into the EState to ensure it is shut down when the * EState is freed. Because we use lcons(), shutdowns will occur in @@ -356,11 +296,6 @@ CreateStandaloneExprContext(void) /* Create the ExprContext node within the caller's memory context */ econtext = makeNode(ExprContext); - /* Initialize fields of ExprContext */ - econtext->ecxt_scantuple = NULL; - econtext->ecxt_innertuple = NULL; - econtext->ecxt_outertuple = NULL; - econtext->ecxt_per_query_memory = CurrentMemoryContext; /* @@ -371,22 +306,12 @@ CreateStandaloneExprContext(void) "ExprContext", ALLOCSET_DEFAULT_SIZES); - econtext->ecxt_param_exec_vals = NULL; - econtext->ecxt_param_list_info = NULL; - - econtext->ecxt_aggvalues = NULL; - econtext->ecxt_aggnulls = NULL; - econtext->caseValue_datum = (Datum) 0; econtext->caseValue_isNull = true; econtext->domainValue_datum = (Datum) 0; econtext->domainValue_isNull = true; - econtext->ecxt_estate = NULL; - - econtext->ecxt_callbacks = NULL; - return econtext; } diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 8440a76fbd..bda7bb7f08 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -3280,24 +3280,9 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) aggstate->ss.ps.state = estate; aggstate->ss.ps.ExecProcNode = ExecAgg; - aggstate->aggs = NIL; - aggstate->numaggs = 0; - aggstate->numtrans = 0; aggstate->aggstrategy = node->aggstrategy; aggstate->aggsplit = node->aggsplit; - aggstate->maxsets = 0; aggstate->projected_set = -1; - aggstate->current_set = 0; - aggstate->peragg = NULL; - aggstate->pertrans = NULL; - aggstate->curperagg = NULL; - aggstate->curpertrans = NULL; - aggstate->input_done = false; - aggstate->agg_done = false; - aggstate->pergroups = NULL; - aggstate->grp_firstTuple = NULL; - aggstate->sort_in = NULL; - aggstate->sort_out = NULL; /* * phases[0] always exists, but is dummy in sorted/plain mode diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 2db1914aff..3d7b73e77d 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -725,23 +725,6 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags) scanstate->ss.ps.state = estate; scanstate->ss.ps.ExecProcNode = ExecBitmapHeapScan; - scanstate->tbm = NULL; - scanstate->tbmiterator = NULL; - scanstate->tbmres = NULL; - scanstate->return_empty_tuples = 0; - scanstate->vmbuffer = InvalidBuffer; - scanstate->pvmbuffer = InvalidBuffer; - scanstate->exact_pages = 0; - scanstate->lossy_pages = 0; - scanstate->prefetch_iterator = NULL; - scanstate->prefetch_pages = 0; - scanstate->prefetch_target = 0; - scanstate->pscan_len = 0; - scanstate->initialized = false; - scanstate->shared_tbmiterator = NULL; - scanstate->shared_prefetch_iterator = NULL; - scanstate->pstate = NULL; - /* * We can potentially skip fetching heap pages if we do not need any * columns of the table, either for checking non-indexable quals or for diff --git a/src/backend/executor/nodeCtescan.c b/src/backend/executor/nodeCtescan.c index 9c2b08d1d8..414587498c 100644 --- a/src/backend/executor/nodeCtescan.c +++ b/src/backend/executor/nodeCtescan.c @@ -208,8 +208,6 @@ ExecInitCteScan(CteScan *node, EState *estate, int eflags) scanstate->ss.ps.state = estate; scanstate->ss.ps.ExecProcNode = ExecCteScan; scanstate->eflags = eflags; - scanstate->cte_table = NULL; - scanstate->eof_cte = false; /* * Find the already-initialized plan for the CTE query. diff --git a/src/backend/executor/nodeForeignscan.c b/src/backend/executor/nodeForeignscan.c index 9dc38d47ea..b0600f9bf9 100644 --- a/src/backend/executor/nodeForeignscan.c +++ b/src/backend/executor/nodeForeignscan.c @@ -220,7 +220,6 @@ ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags) * Initialize FDW-related state. */ scanstate->fdwroutine = fdwroutine; - scanstate->fdw_state = NULL; /* * For the FDW's convenience, look up the modification target relation's. diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index c5f2d1d22b..b30fab7b86 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -365,7 +365,6 @@ ExecInitHash(Hash *node, EState *estate, int eflags) hashstate->ps.plan = (Plan *) node; hashstate->ps.state = estate; hashstate->ps.ExecProcNode = ExecHash; - hashstate->hashtable = NULL; hashstate->hashkeys = NIL; /* will be set by parent HashJoin */ /* diff --git a/src/backend/executor/nodeIndexonlyscan.c b/src/backend/executor/nodeIndexonlyscan.c index 0754e28a9a..9bf3c03624 100644 --- a/src/backend/executor/nodeIndexonlyscan.c +++ b/src/backend/executor/nodeIndexonlyscan.c @@ -570,13 +570,6 @@ ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags) lockmode = exec_rt_fetch(node->scan.scanrelid, estate)->rellockmode; indexstate->ioss_RelationDesc = index_open(node->indexid, lockmode); - /* - * Initialize index-specific scan state - */ - indexstate->ioss_RuntimeKeysReady = false; - indexstate->ioss_RuntimeKeys = NULL; - indexstate->ioss_NumRuntimeKeys = 0; - /* * build the index scan keys from the index qualification */ @@ -619,10 +612,6 @@ ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags) indexstate->ioss_RuntimeContext = indexstate->ss.ps.ps_ExprContext; indexstate->ss.ps.ps_ExprContext = stdecontext; } - else - { - indexstate->ioss_RuntimeContext = NULL; - } /* * all done. diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 2fffb1b437..0d3651f7b6 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -968,13 +968,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags) lockmode = exec_rt_fetch(node->scan.scanrelid, estate)->rellockmode; indexstate->iss_RelationDesc = index_open(node->indexid, lockmode); - /* - * Initialize index-specific scan state - */ - indexstate->iss_RuntimeKeysReady = false; - indexstate->iss_RuntimeKeys = NULL; - indexstate->iss_NumRuntimeKeys = 0; - /* * build the index scan keys from the index qualification */ @@ -1074,10 +1067,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags) indexstate->iss_RuntimeContext = indexstate->ss.ps.ps_ExprContext; indexstate->ss.ps.ps_ExprContext = stdecontext; } - else - { - indexstate->iss_RuntimeContext = NULL; - } /* * all done. diff --git a/src/backend/executor/nodeRecursiveunion.c b/src/backend/executor/nodeRecursiveunion.c index f9e91fdcfc..f80578d541 100644 --- a/src/backend/executor/nodeRecursiveunion.c +++ b/src/backend/executor/nodeRecursiveunion.c @@ -180,14 +180,7 @@ ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags) rustate->ps.state = estate; rustate->ps.ExecProcNode = ExecRecursiveUnion; - rustate->eqfuncoids = NULL; - rustate->hashfunctions = NULL; - rustate->hashtable = NULL; - rustate->tempContext = NULL; - rustate->tableContext = NULL; - /* initialize processing state */ - rustate->recursing = false; rustate->intermediate_empty = true; rustate->working_table = tuplestore_begin_heap(false, false, work_mem); rustate->intermediate_table = tuplestore_begin_heap(false, false, work_mem); diff --git a/src/backend/executor/nodeSamplescan.c b/src/backend/executor/nodeSamplescan.c index 44232d50d0..38820f68aa 100644 --- a/src/backend/executor/nodeSamplescan.c +++ b/src/backend/executor/nodeSamplescan.c @@ -161,7 +161,6 @@ ExecInitSampleScan(SampleScan *node, EState *estate, int eflags) */ tsm = GetTsmRoutine(tsc->tsmhandler); scanstate->tsmroutine = tsm; - scanstate->tsm_state = NULL; if (tsm->InitSampleScan) tsm->InitSampleScan(scanstate, eflags); diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c index d46227e65c..990b1cb1d3 100644 --- a/src/backend/executor/nodeSubplan.c +++ b/src/backend/executor/nodeSubplan.c @@ -812,26 +812,6 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent) sstate->testexpr = ExecInitExpr((Expr *) subplan->testexpr, parent); sstate->args = ExecInitExprList(subplan->args, parent); - /* - * initialize my state - */ - sstate->curTuple = NULL; - sstate->curArray = PointerGetDatum(NULL); - sstate->projLeft = NULL; - sstate->projRight = NULL; - sstate->hashtable = NULL; - sstate->hashnulls = NULL; - sstate->hashtablecxt = NULL; - sstate->hashtempcxt = NULL; - sstate->innerecontext = NULL; - sstate->keyColIdx = NULL; - sstate->tab_eq_funcoids = NULL; - sstate->tab_hash_funcs = NULL; - sstate->tab_eq_funcs = NULL; - sstate->tab_collations = NULL; - sstate->lhs_hash_funcs = NULL; - sstate->cur_eq_funcs = NULL; - /* * If this is an initplan or MULTIEXPR subplan, it has output parameters * that the parent plan will use, so mark those parameters as needing diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c index 01c110cd2f..34a2667404 100644 --- a/src/backend/nodes/makefuncs.c +++ b/src/backend/nodes/makefuncs.c @@ -423,12 +423,10 @@ makeRangeVar(char *schemaname, char *relname, int location) { RangeVar *r = makeNode(RangeVar); - r->catalogname = NULL; r->schemaname = schemaname; r->relname = relname; r->inh = true; r->relpersistence = RELPERSISTENCE_PERMANENT; - r->alias = NULL; r->location = location; return r; @@ -493,17 +491,8 @@ makeColumnDef(const char *colname, Oid typeOid, int32 typmod, Oid collOid) n->colname = pstrdup(colname); n->typeName = makeTypeNameFromOid(typeOid, typmod); - n->inhcount = 0; n->is_local = true; - n->is_not_null = false; - n->is_from_type = false; - n->storage = 0; - n->raw_default = NULL; - n->cooked_default = NULL; - n->collClause = NULL; n->collOid = collOid; - n->constraints = NIL; - n->fdwoptions = NIL; n->location = -1; return n; @@ -547,7 +536,6 @@ makeDefElem(char *name, Node *arg, int location) { DefElem *res = makeNode(DefElem); - res->defnamespace = NULL; res->defname = name; res->arg = arg; res->defaction = DEFELEM_UNSPEC; @@ -588,13 +576,6 @@ makeFuncCall(List *name, List *args, CoercionForm funcformat, int location) n->funcname = name; n->args = args; - n->agg_order = NIL; - n->agg_filter = NULL; - n->over = NULL; - n->agg_within_group = false; - n->agg_star = false; - n->agg_distinct = false; - n->func_variadic = false; n->funcformat = funcformat; n->location = location; return n; @@ -752,35 +733,10 @@ makeIndexInfo(int numattrs, int numkeyattrs, Oid amoid, List *expressions, n->ii_Unique = unique; n->ii_ReadyForInserts = isready; n->ii_Concurrent = concurrent; - - /* expressions */ n->ii_Expressions = expressions; - n->ii_ExpressionsState = NIL; - - /* predicates */ n->ii_Predicate = predicates; - n->ii_PredicateState = NULL; - - /* exclusion constraints */ - n->ii_ExclusionOps = NULL; - n->ii_ExclusionProcs = NULL; - n->ii_ExclusionStrats = NULL; - - /* opclass options */ - n->ii_OpclassOptions = NULL; - - /* speculative inserts */ - n->ii_UniqueOps = NULL; - n->ii_UniqueProcs = NULL; - n->ii_UniqueStrats = NULL; - - /* initialize index-build state to default */ - n->ii_BrokenHotChain = false; - n->ii_ParallelWorkers = 0; - /* set up for possible use by index AM */ n->ii_Am = amoid; - n->ii_AmCache = NULL; n->ii_Context = CurrentMemoryContext; return n; diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 1868c4eff4..e92eb14456 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -293,23 +293,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions, * PlannerInfo. */ glob = makeNode(PlannerGlobal); - glob->boundParams = boundParams; - glob->subplans = NIL; - glob->subroots = NIL; - glob->rewindPlanIDs = NULL; - glob->finalrtable = NIL; - glob->finalrowmarks = NIL; - glob->resultRelations = NIL; - glob->appendRelations = NIL; - glob->relationOids = NIL; - glob->invalItems = NIL; - glob->paramExecTypes = NIL; - glob->lastPHId = 0; - glob->lastRowMarkId = 0; - glob->lastPlanNodeId = 0; - glob->transientPlan = false; - glob->dependsOnRole = false; /* * Assess whether it's feasible to use parallel mode for this query. We @@ -605,36 +589,15 @@ subquery_planner(PlannerGlobal *glob, Query *parse, root->glob = glob; root->query_level = parent_root ? parent_root->query_level + 1 : 1; root->parent_root = parent_root; - root->plan_params = NIL; - root->outer_params = NULL; root->planner_cxt = CurrentMemoryContext; - root->init_plans = NIL; - root->cte_plan_ids = NIL; - root->multiexpr_params = NIL; - root->eq_classes = NIL; - root->ec_merging_done = false; root->all_result_relids = parse->resultRelation ? bms_make_singleton(parse->resultRelation) : NULL; root->leaf_result_relids = NULL; /* we'll find out leaf-ness later */ - root->append_rel_list = NIL; - root->row_identity_vars = NIL; - root->rowMarks = NIL; - memset(root->upper_rels, 0, sizeof(root->upper_rels)); - memset(root->upper_targets, 0, sizeof(root->upper_targets)); - root->processed_tlist = NIL; - root->update_colnos = NIL; - root->grouping_map = NULL; - root->minmax_aggs = NIL; - root->qual_security_level = 0; - root->hasPseudoConstantQuals = false; - root->hasAlternativeSubPlans = false; root->hasRecursion = hasRecursion; if (hasRecursion) root->wt_param_id = assign_special_exec_param(root); else root->wt_param_id = -1; - root->non_recursive_path = NULL; - root->partColsUpdated = false; /* * If there is a WITH list, process each WITH query and either convert it @@ -1915,11 +1878,6 @@ preprocess_grouping_sets(PlannerInfo *root) parse->groupingSets = expand_grouping_sets(parse->groupingSets, parse->groupDistinct, -1); - gd->any_hashable = false; - gd->unhashable_refs = NULL; - gd->unsortable_refs = NULL; - gd->unsortable_sets = NIL; - if (parse->groupClause) { ListCell *lc; @@ -3813,12 +3771,9 @@ consider_groupingsets_paths(PlannerInfo *root, { RollupData *rollup = makeNode(RollupData); - rollup->groupClause = NIL; rollup->gsets_data = empty_sets_data; rollup->gsets = empty_sets; rollup->numGroups = list_length(empty_sets); - rollup->hashable = false; - rollup->is_hashed = false; new_rollups = lappend(new_rollups, rollup); strat = AGG_MIXED; } @@ -5688,8 +5643,6 @@ expression_planner_with_deps(Expr *expr, /* Make up dummy planner state so we can use setrefs machinery */ MemSet(&glob, 0, sizeof(glob)); glob.type = T_PlannerGlobal; - glob.relationOids = NIL; - glob.invalItems = NIL; MemSet(&root, 0, sizeof(root)); root.type = T_PlannerInfo; diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c index 0881a208ac..a3830a9132 100644 --- a/src/backend/optimizer/plan/subselect.c +++ b/src/backend/optimizer/plan/subselect.c @@ -335,16 +335,10 @@ build_subplan(PlannerInfo *root, Plan *plan, PlannerInfo *subroot, */ splan = makeNode(SubPlan); splan->subLinkType = subLinkType; - splan->testexpr = NULL; - splan->paramIds = NIL; get_first_col_type(plan, &splan->firstColType, &splan->firstColTypmod, &splan->firstColCollation); - splan->useHashTable = false; splan->unknownEqFalse = unknownEqFalse; splan->parallel_safe = plan->parallel_safe; - splan->setParam = NIL; - splan->parParam = NIL; - splan->args = NIL; /* * Make parParam and args lists of param IDs and expressions that current @@ -1008,12 +1002,8 @@ SS_process_ctes(PlannerInfo *root) */ splan = makeNode(SubPlan); splan->subLinkType = CTE_SUBLINK; - splan->testexpr = NULL; - splan->paramIds = NIL; get_first_col_type(plan, &splan->firstColType, &splan->firstColTypmod, &splan->firstColCollation); - splan->useHashTable = false; - splan->unknownEqFalse = false; /* * CTE scans are not considered for parallelism (cf @@ -1021,9 +1011,6 @@ SS_process_ctes(PlannerInfo *root) * parallel-safe. */ splan->parallel_safe = false; - splan->setParam = NIL; - splan->parParam = NIL; - splan->args = NIL; /* * The node can't have any inputs (since it's an initplan), so the diff --git a/src/backend/optimizer/prep/prepjointree.c b/src/backend/optimizer/prep/prepjointree.c index 62a1668796..daba891b4a 100644 --- a/src/backend/optimizer/prep/prepjointree.c +++ b/src/backend/optimizer/prep/prepjointree.c @@ -912,29 +912,8 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, subroot->glob = root->glob; subroot->query_level = root->query_level; subroot->parent_root = root->parent_root; - subroot->plan_params = NIL; - subroot->outer_params = NULL; subroot->planner_cxt = CurrentMemoryContext; - subroot->init_plans = NIL; - subroot->cte_plan_ids = NIL; - subroot->multiexpr_params = NIL; - subroot->eq_classes = NIL; - subroot->ec_merging_done = false; - subroot->all_result_relids = NULL; - subroot->leaf_result_relids = NULL; - subroot->append_rel_list = NIL; - subroot->row_identity_vars = NIL; - subroot->rowMarks = NIL; - memset(subroot->upper_rels, 0, sizeof(subroot->upper_rels)); - memset(subroot->upper_targets, 0, sizeof(subroot->upper_targets)); - subroot->processed_tlist = NIL; - subroot->update_colnos = NIL; - subroot->grouping_map = NULL; - subroot->minmax_aggs = NIL; - subroot->qual_security_level = 0; - subroot->hasRecursion = false; subroot->wt_param_id = -1; - subroot->non_recursive_path = NULL; /* No CTEs to worry about */ Assert(subquery->cteList == NIL); diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index e105a4d5f1..c2f779ac12 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -208,56 +208,15 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent) rel = makeNode(RelOptInfo); rel->reloptkind = parent ? RELOPT_OTHER_MEMBER_REL : RELOPT_BASEREL; rel->relids = bms_make_singleton(relid); - rel->rows = 0; /* cheap startup cost is interesting iff not all tuples to be retrieved */ rel->consider_startup = (root->tuple_fraction > 0); - rel->consider_param_startup = false; /* might get changed later */ - rel->consider_parallel = false; /* might get changed later */ rel->reltarget = create_empty_pathtarget(); - rel->pathlist = NIL; - rel->ppilist = NIL; - rel->partial_pathlist = NIL; - rel->cheapest_startup_path = NULL; - rel->cheapest_total_path = NULL; - rel->cheapest_unique_path = NULL; - rel->cheapest_parameterized_paths = NIL; rel->relid = relid; rel->rtekind = rte->rtekind; - /* min_attr, max_attr, attr_needed, attr_widths are set below */ - rel->lateral_vars = NIL; - rel->indexlist = NIL; - rel->statlist = NIL; - rel->pages = 0; - rel->tuples = 0; - rel->allvisfrac = 0; - rel->eclass_indexes = NULL; - rel->subroot = NULL; - rel->subplan_params = NIL; rel->rel_parallel_workers = -1; /* set up in get_relation_info */ - rel->amflags = 0; - rel->serverid = InvalidOid; rel->userid = rte->checkAsUser; - rel->useridiscurrent = false; - rel->fdwroutine = NULL; - rel->fdw_private = NULL; - rel->unique_for_rels = NIL; - rel->non_unique_for_rels = NIL; - rel->baserestrictinfo = NIL; - rel->baserestrictcost.startup = 0; - rel->baserestrictcost.per_tuple = 0; rel->baserestrict_min_security = UINT_MAX; - rel->joininfo = NIL; - rel->has_eclass_joins = false; - rel->consider_partitionwise_join = false; /* might get changed later */ - rel->part_scheme = NULL; rel->nparts = -1; - rel->boundinfo = NULL; - rel->partbounds_merged = false; - rel->partition_qual = NIL; - rel->part_rels = NULL; - rel->all_partrels = NULL; - rel->partexprs = NULL; - rel->nullable_partexprs = NULL; /* * Pass assorted information down the inheritance hierarchy. @@ -291,13 +250,6 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent) rel->lateral_relids = parent->lateral_relids; rel->lateral_referencers = parent->lateral_referencers; } - else - { - rel->top_parent_relids = NULL; - rel->direct_lateral_relids = NULL; - rel->lateral_relids = NULL; - rel->lateral_referencers = NULL; - } /* Check type of rtable entry */ switch (rte->rtekind) @@ -611,19 +563,9 @@ build_join_rel(PlannerInfo *root, joinrel = makeNode(RelOptInfo); joinrel->reloptkind = RELOPT_JOINREL; joinrel->relids = bms_copy(joinrelids); - joinrel->rows = 0; /* cheap startup cost is interesting iff not all tuples to be retrieved */ joinrel->consider_startup = (root->tuple_fraction > 0); - joinrel->consider_param_startup = false; - joinrel->consider_parallel = false; joinrel->reltarget = create_empty_pathtarget(); - joinrel->pathlist = NIL; - joinrel->ppilist = NIL; - joinrel->partial_pathlist = NIL; - joinrel->cheapest_startup_path = NULL; - joinrel->cheapest_total_path = NULL; - joinrel->cheapest_unique_path = NULL; - joinrel->cheapest_parameterized_paths = NIL; /* init direct_lateral_relids from children; we'll finish it up below */ joinrel->direct_lateral_relids = bms_union(outer_rel->direct_lateral_relids, @@ -632,46 +574,9 @@ build_join_rel(PlannerInfo *root, outer_rel, inner_rel); joinrel->relid = 0; /* indicates not a baserel */ joinrel->rtekind = RTE_JOIN; - joinrel->min_attr = 0; - joinrel->max_attr = 0; - joinrel->attr_needed = NULL; - joinrel->attr_widths = NULL; - joinrel->lateral_vars = NIL; - joinrel->lateral_referencers = NULL; - joinrel->indexlist = NIL; - joinrel->statlist = NIL; - joinrel->pages = 0; - joinrel->tuples = 0; - joinrel->allvisfrac = 0; - joinrel->eclass_indexes = NULL; - joinrel->subroot = NULL; - joinrel->subplan_params = NIL; joinrel->rel_parallel_workers = -1; - joinrel->amflags = 0; - joinrel->serverid = InvalidOid; - joinrel->userid = InvalidOid; - joinrel->useridiscurrent = false; - joinrel->fdwroutine = NULL; - joinrel->fdw_private = NULL; - joinrel->unique_for_rels = NIL; - joinrel->non_unique_for_rels = NIL; - joinrel->baserestrictinfo = NIL; - joinrel->baserestrictcost.startup = 0; - joinrel->baserestrictcost.per_tuple = 0; joinrel->baserestrict_min_security = UINT_MAX; - joinrel->joininfo = NIL; - joinrel->has_eclass_joins = false; - joinrel->consider_partitionwise_join = false; /* might get changed later */ - joinrel->top_parent_relids = NULL; - joinrel->part_scheme = NULL; joinrel->nparts = -1; - joinrel->boundinfo = NULL; - joinrel->partbounds_merged = false; - joinrel->partition_qual = NIL; - joinrel->part_rels = NULL; - joinrel->all_partrels = NULL; - joinrel->partexprs = NULL; - joinrel->nullable_partexprs = NULL; /* Compute information relevant to the foreign relations. */ set_foreign_rel_properties(joinrel, outer_rel, inner_rel); @@ -798,58 +703,12 @@ build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel, joinrel->reloptkind = RELOPT_OTHER_JOINREL; joinrel->relids = bms_union(outer_rel->relids, inner_rel->relids); - joinrel->rows = 0; /* cheap startup cost is interesting iff not all tuples to be retrieved */ joinrel->consider_startup = (root->tuple_fraction > 0); - joinrel->consider_param_startup = false; - joinrel->consider_parallel = false; joinrel->reltarget = create_empty_pathtarget(); - joinrel->pathlist = NIL; - joinrel->ppilist = NIL; - joinrel->partial_pathlist = NIL; - joinrel->cheapest_startup_path = NULL; - joinrel->cheapest_total_path = NULL; - joinrel->cheapest_unique_path = NULL; - joinrel->cheapest_parameterized_paths = NIL; - joinrel->direct_lateral_relids = NULL; - joinrel->lateral_relids = NULL; joinrel->relid = 0; /* indicates not a baserel */ joinrel->rtekind = RTE_JOIN; - joinrel->min_attr = 0; - joinrel->max_attr = 0; - joinrel->attr_needed = NULL; - joinrel->attr_widths = NULL; - joinrel->lateral_vars = NIL; - joinrel->lateral_referencers = NULL; - joinrel->indexlist = NIL; - joinrel->pages = 0; - joinrel->tuples = 0; - joinrel->allvisfrac = 0; - joinrel->eclass_indexes = NULL; - joinrel->subroot = NULL; - joinrel->subplan_params = NIL; - joinrel->amflags = 0; - joinrel->serverid = InvalidOid; - joinrel->userid = InvalidOid; - joinrel->useridiscurrent = false; - joinrel->fdwroutine = NULL; - joinrel->fdw_private = NULL; - joinrel->baserestrictinfo = NIL; - joinrel->baserestrictcost.startup = 0; - joinrel->baserestrictcost.per_tuple = 0; - joinrel->joininfo = NIL; - joinrel->has_eclass_joins = false; - joinrel->consider_partitionwise_join = false; /* might get changed later */ - joinrel->top_parent_relids = NULL; - joinrel->part_scheme = NULL; joinrel->nparts = -1; - joinrel->boundinfo = NULL; - joinrel->partbounds_merged = false; - joinrel->partition_qual = NIL; - joinrel->part_rels = NULL; - joinrel->all_partrels = NULL; - joinrel->partexprs = NULL; - joinrel->nullable_partexprs = NULL; joinrel->top_parent_relids = bms_union(outer_rel->top_parent_relids, inner_rel->top_parent_relids); @@ -1231,14 +1090,7 @@ fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids) /* cheap startup cost is interesting iff not all tuples to be retrieved */ upperrel->consider_startup = (root->tuple_fraction > 0); - upperrel->consider_param_startup = false; - upperrel->consider_parallel = false; /* might get changed later */ upperrel->reltarget = create_empty_pathtarget(); - upperrel->pathlist = NIL; - upperrel->cheapest_startup_path = NULL; - upperrel->cheapest_total_path = NULL; - upperrel->cheapest_unique_path = NULL; - upperrel->cheapest_parameterized_paths = NIL; root->upper_rels[kind] = lappend(root->upper_rels[kind], upperrel); diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c index aa9fb3a9fa..8de2a9ccd8 100644 --- a/src/backend/optimizer/util/restrictinfo.c +++ b/src/backend/optimizer/util/restrictinfo.c @@ -134,8 +134,6 @@ make_restrictinfo_internal(PlannerInfo *root, */ if (security_level > 0) restrictinfo->leakproof = !contain_leaked_vars((Node *) clause); - else - restrictinfo->leakproof = false; /* really, "don't know" */ /* * Mark volatility as unknown. The contain_volatile_functions function @@ -174,10 +172,7 @@ make_restrictinfo_internal(PlannerInfo *root, } else { - /* Not a binary opclause, so mark left/right relid sets as empty */ - restrictinfo->left_relids = NULL; - restrictinfo->right_relids = NULL; - /* and get the total relid set the hard way */ + /* Not a binary opclause, so get the total relid set the hard way */ restrictinfo->clause_relids = pull_varnos(root, (Node *) clause); } @@ -194,24 +189,11 @@ make_restrictinfo_internal(PlannerInfo *root, * that happens only if it appears in the right context (top level of a * joinclause list). */ - restrictinfo->parent_ec = NULL; restrictinfo->eval_cost.startup = -1; restrictinfo->norm_selec = -1; restrictinfo->outer_selec = -1; - restrictinfo->mergeopfamilies = NIL; - - restrictinfo->left_ec = NULL; - restrictinfo->right_ec = NULL; - restrictinfo->left_em = NULL; - restrictinfo->right_em = NULL; - restrictinfo->scansel_cache = NIL; - - restrictinfo->outer_is_left = false; - - restrictinfo->hashjoinoperator = InvalidOid; - restrictinfo->left_bucketsize = -1; restrictinfo->right_bucketsize = -1; restrictinfo->left_mcvfreq = -1; diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 438b077004..3e7b7a138d 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -449,9 +449,6 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt) ACL_DELETE); nsitem = pstate->p_target_nsitem; - /* there's no DISTINCT in DELETE */ - qry->distinctClause = NIL; - /* subqueries in USING cannot access the result relation */ nsitem->p_lateral_only = true; nsitem->p_lateral_ok = false; diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index eb24195438..c7350f5a45 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -2134,7 +2134,6 @@ partition_cmd: n->subtype = AT_DetachPartition; cmd->name = $3; - cmd->bound = NULL; cmd->concurrent = $4; n->def = (Node *) cmd; @@ -2163,8 +2162,6 @@ index_partition_cmd: n->subtype = AT_AttachPartition; cmd->name = $3; - cmd->bound = NULL; - cmd->concurrent = false; n->def = (Node *) cmd; $$ = (Node *) n; @@ -2473,7 +2470,6 @@ alter_table_cmd: { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropCluster; - n->name = NULL; $$ = (Node *)n; } /* ALTER TABLE SET LOGGED */ @@ -2707,7 +2703,6 @@ opt_collate_clause: COLLATE any_name { CollateClause *n = makeNode(CollateClause); - n->arg = NULL; n->collname = $2; n->location = @1; $$ = (Node *) n; @@ -2725,21 +2720,18 @@ replica_identity: { ReplicaIdentityStmt *n = makeNode(ReplicaIdentityStmt); n->identity_type = REPLICA_IDENTITY_NOTHING; - n->name = NULL; $$ = (Node *) n; } | FULL { ReplicaIdentityStmt *n = makeNode(ReplicaIdentityStmt); n->identity_type = REPLICA_IDENTITY_FULL; - n->name = NULL; $$ = (Node *) n; } | DEFAULT { ReplicaIdentityStmt *n = makeNode(ReplicaIdentityStmt); n->identity_type = REPLICA_IDENTITY_DEFAULT; - n->name = NULL; $$ = (Node *) n; } | USING INDEX name @@ -2996,7 +2988,6 @@ alter_type_cmd: /* We only use these fields of the ColumnDef node */ def->typeName = $6; def->collClause = (CollateClause *) $7; - def->raw_default = NULL; def->location = @3; $$ = (Node *)n; } @@ -3276,13 +3267,10 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' n->tableElts = $6; n->inhRelations = $8; n->partspec = $9; - n->ofTypename = NULL; - n->constraints = NIL; n->accessMethod = $10; n->options = $11; n->oncommit = $12; n->tablespacename = $13; - n->if_not_exists = false; $$ = (Node *)n; } | CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name '(' @@ -3295,8 +3283,6 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' n->tableElts = $9; n->inhRelations = $11; n->partspec = $12; - n->ofTypename = NULL; - n->constraints = NIL; n->accessMethod = $13; n->options = $14; n->oncommit = $15; @@ -3355,13 +3341,10 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' n->inhRelations = list_make1($7); n->partbound = $9; n->partspec = $10; - n->ofTypename = NULL; - n->constraints = NIL; n->accessMethod = $11; n->options = $12; n->oncommit = $13; n->tablespacename = $14; - n->if_not_exists = false; $$ = (Node *)n; } | CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name PARTITION OF @@ -3375,8 +3358,6 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' n->inhRelations = list_make1($10); n->partbound = $12; n->partspec = $13; - n->ofTypename = NULL; - n->constraints = NIL; n->accessMethod = $14; n->options = $15; n->oncommit = $16; @@ -3468,14 +3449,7 @@ columnDef: ColId Typename opt_column_compression create_generic_options ColQualL n->colname = $1; n->typeName = $2; n->compression = $3; - n->inhcount = 0; n->is_local = true; - n->is_not_null = false; - n->is_from_type = false; - n->storage = 0; - n->raw_default = NULL; - n->cooked_default = NULL; - n->collOid = InvalidOid; n->fdwoptions = $4; SplitColQualList($5, &n->constraints, &n->collClause, yyscanner); @@ -3488,15 +3462,7 @@ columnOptions: ColId ColQualList { ColumnDef *n = makeNode(ColumnDef); n->colname = $1; - n->typeName = NULL; - n->inhcount = 0; n->is_local = true; - n->is_not_null = false; - n->is_from_type = false; - n->storage = 0; - n->raw_default = NULL; - n->cooked_default = NULL; - n->collOid = InvalidOid; SplitColQualList($2, &n->constraints, &n->collClause, yyscanner); n->location = @1; @@ -3506,15 +3472,7 @@ columnOptions: ColId ColQualList { ColumnDef *n = makeNode(ColumnDef); n->colname = $1; - n->typeName = NULL; - n->inhcount = 0; n->is_local = true; - n->is_not_null = false; - n->is_from_type = false; - n->storage = 0; - n->raw_default = NULL; - n->cooked_default = NULL; - n->collOid = InvalidOid; SplitColQualList($4, &n->constraints, &n->collClause, yyscanner); n->location = @1; @@ -3555,7 +3513,6 @@ ColConstraint: * again in SplitColQualList. */ CollateClause *n = makeNode(CollateClause); - n->arg = NULL; n->collname = $2; n->location = @1; $$ = (Node *) n; @@ -3597,9 +3554,7 @@ ColConstraintElem: Constraint *n = makeNode(Constraint); n->contype = CONSTR_UNIQUE; n->location = @1; - n->keys = NULL; n->options = $2; - n->indexname = NULL; n->indexspace = $3; $$ = (Node *)n; } @@ -3608,9 +3563,7 @@ ColConstraintElem: Constraint *n = makeNode(Constraint); n->contype = CONSTR_PRIMARY; n->location = @1; - n->keys = NULL; n->options = $3; - n->indexname = NULL; n->indexspace = $4; $$ = (Node *)n; } @@ -3621,8 +3574,6 @@ ColConstraintElem: n->location = @1; n->is_no_inherit = $5; n->raw_expr = $3; - n->cooked_expr = NULL; - n->skip_validation = false; n->initially_valid = true; $$ = (Node *)n; } @@ -3632,7 +3583,6 @@ ColConstraintElem: n->contype = CONSTR_DEFAULT; n->location = @1; n->raw_expr = $2; - n->cooked_expr = NULL; $$ = (Node *)n; } | GENERATED generated_when AS IDENTITY_P OptParenthesizedSeqOptList @@ -3673,12 +3623,10 @@ ColConstraintElem: n->contype = CONSTR_FOREIGN; n->location = @1; n->pktable = $2; - n->fk_attrs = NIL; n->pk_attrs = $3; n->fk_matchtype = $4; n->fk_upd_action = (char) ($5 >> 8); n->fk_del_action = (char) ($5 & 0xFF); - n->skip_validation = false; n->initially_valid = true; $$ = (Node *)n; } @@ -3789,7 +3737,6 @@ ConstraintElem: n->contype = CONSTR_CHECK; n->location = @1; n->raw_expr = $3; - n->cooked_expr = NULL; processCASbits($5, @5, "CHECK", NULL, NULL, &n->skip_validation, &n->is_no_inherit, yyscanner); @@ -3805,7 +3752,6 @@ ConstraintElem: n->keys = $3; n->including = $5; n->options = $6; - n->indexname = NULL; n->indexspace = $7; processCASbits($8, @8, "UNIQUE", &n->deferrable, &n->initdeferred, NULL, @@ -3817,11 +3763,7 @@ ConstraintElem: Constraint *n = makeNode(Constraint); n->contype = CONSTR_UNIQUE; n->location = @1; - n->keys = NIL; - n->including = NIL; - n->options = NIL; n->indexname = $2; - n->indexspace = NULL; processCASbits($3, @3, "UNIQUE", &n->deferrable, &n->initdeferred, NULL, NULL, yyscanner); @@ -3836,7 +3778,6 @@ ConstraintElem: n->keys = $4; n->including = $6; n->options = $7; - n->indexname = NULL; n->indexspace = $8; processCASbits($9, @9, "PRIMARY KEY", &n->deferrable, &n->initdeferred, NULL, @@ -3848,11 +3789,7 @@ ConstraintElem: Constraint *n = makeNode(Constraint); n->contype = CONSTR_PRIMARY; n->location = @1; - n->keys = NIL; - n->including = NIL; - n->options = NIL; n->indexname = $3; - n->indexspace = NULL; processCASbits($4, @4, "PRIMARY KEY", &n->deferrable, &n->initdeferred, NULL, NULL, yyscanner); @@ -3869,7 +3806,6 @@ ConstraintElem: n->exclusions = $4; n->including = $6; n->options = $7; - n->indexname = NULL; n->indexspace = $8; n->where_clause = $9; processCASbits($10, @10, "EXCLUDE", @@ -4029,7 +3965,6 @@ part_elem: ColId opt_collate opt_class PartitionElem *n = makeNode(PartitionElem); n->name = $1; - n->expr = NULL; n->collation = $2; n->opclass = $3; n->location = @1; @@ -4039,7 +3974,6 @@ part_elem: ColId opt_collate opt_class { PartitionElem *n = makeNode(PartitionElem); - n->name = NULL; n->expr = $1; n->collation = $2; n->opclass = $3; @@ -4050,7 +3984,6 @@ part_elem: ColId opt_collate opt_class { PartitionElem *n = makeNode(PartitionElem); - n->name = NULL; n->expr = $2; n->collation = $4; n->opclass = $5; @@ -4111,8 +4044,6 @@ CreateStatsStmt: n->stat_types = $4; n->exprs = $6; n->relations = $8; - n->stxcomment = NULL; - n->if_not_exists = false; $$ = (Node *)n; } | CREATE STATISTICS IF_P NOT EXISTS any_name @@ -4123,7 +4054,6 @@ CreateStatsStmt: n->stat_types = $7; n->exprs = $9; n->relations = $11; - n->stxcomment = NULL; n->if_not_exists = true; $$ = (Node *)n; } @@ -5023,12 +4953,6 @@ CreateForeignTableStmt: n->base.relation = $4; n->base.tableElts = $6; n->base.inhRelations = $8; - n->base.ofTypename = NULL; - n->base.constraints = NIL; - n->base.options = NIL; - n->base.oncommit = ONCOMMIT_NOOP; - n->base.tablespacename = NULL; - n->base.if_not_exists = false; /* FDW-specific data */ n->servername = $10; n->options = $11; @@ -5043,11 +4967,6 @@ CreateForeignTableStmt: n->base.relation = $7; n->base.tableElts = $9; n->base.inhRelations = $11; - n->base.ofTypename = NULL; - n->base.constraints = NIL; - n->base.options = NIL; - n->base.oncommit = ONCOMMIT_NOOP; - n->base.tablespacename = NULL; n->base.if_not_exists = true; /* FDW-specific data */ n->servername = $13; @@ -5064,12 +4983,6 @@ CreateForeignTableStmt: n->base.inhRelations = list_make1($7); n->base.tableElts = $8; n->base.partbound = $9; - n->base.ofTypename = NULL; - n->base.constraints = NIL; - n->base.options = NIL; - n->base.oncommit = ONCOMMIT_NOOP; - n->base.tablespacename = NULL; - n->base.if_not_exists = false; /* FDW-specific data */ n->servername = $11; n->options = $12; @@ -5085,11 +4998,6 @@ CreateForeignTableStmt: n->base.inhRelations = list_make1($10); n->base.tableElts = $11; n->base.partbound = $12; - n->base.ofTypename = NULL; - n->base.constraints = NIL; - n->base.options = NIL; - n->base.oncommit = ONCOMMIT_NOOP; - n->base.tablespacename = NULL; n->base.if_not_exists = true; /* FDW-specific data */ n->servername = $14; @@ -5351,7 +5259,6 @@ CreateTrigStmt: { CreateTrigStmt *n = makeNode(CreateTrigStmt); n->replace = $2; - n->isconstraint = false; n->trigname = $4; n->relation = $8; n->funcname = $14; @@ -5362,9 +5269,6 @@ CreateTrigStmt: n->columns = (List *) lsecond($6); n->whenClause = $11; n->transitionRels = $9; - n->deferrable = false; - n->initdeferred = false; - n->constrrel = NULL; $$ = (Node *)n; } | CREATE opt_or_replace CONSTRAINT TRIGGER name AFTER TriggerEvents ON @@ -5388,7 +5292,6 @@ CreateTrigStmt: n->events = intVal(linitial($7)); n->columns = (List *) lsecond($7); n->whenClause = $15; - n->transitionRels = NIL; processCASbits($11, @11, "TRIGGER", &n->deferrable, &n->initdeferred, NULL, NULL, yyscanner); @@ -5593,7 +5496,6 @@ CreateEventTrigStmt: CreateEventTrigStmt *n = makeNode(CreateEventTrigStmt); n->trigname = $4; n->eventname = $6; - n->whenclause = NULL; n->funcname = $9; $$ = (Node *)n; } @@ -5702,7 +5604,6 @@ DefineStmt: n->kind = OBJECT_OPERATOR; n->oldstyle = false; n->defnames = $3; - n->args = NIL; n->definition = $4; $$ = (Node *)n; } @@ -5712,7 +5613,6 @@ DefineStmt: n->kind = OBJECT_TYPE; n->oldstyle = false; n->defnames = $3; - n->args = NIL; n->definition = $4; $$ = (Node *)n; } @@ -5723,7 +5623,6 @@ DefineStmt: n->kind = OBJECT_TYPE; n->oldstyle = false; n->defnames = $3; - n->args = NIL; n->definition = NIL; $$ = (Node *)n; } @@ -5754,7 +5653,6 @@ DefineStmt: { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_TSPARSER; - n->args = NIL; n->defnames = $5; n->definition = $6; $$ = (Node *)n; @@ -5763,7 +5661,6 @@ DefineStmt: { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_TSDICTIONARY; - n->args = NIL; n->defnames = $5; n->definition = $6; $$ = (Node *)n; @@ -5772,7 +5669,6 @@ DefineStmt: { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_TSTEMPLATE; - n->args = NIL; n->defnames = $5; n->definition = $6; $$ = (Node *)n; @@ -5781,7 +5677,6 @@ DefineStmt: { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_TSCONFIGURATION; - n->args = NIL; n->defnames = $5; n->definition = $6; $$ = (Node *)n; @@ -5790,7 +5685,6 @@ DefineStmt: { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_COLLATION; - n->args = NIL; n->defnames = $3; n->definition = $4; $$ = (Node *)n; @@ -5799,7 +5693,6 @@ DefineStmt: { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_COLLATION; - n->args = NIL; n->defnames = $6; n->definition = $7; n->if_not_exists = true; @@ -5809,7 +5702,6 @@ DefineStmt: { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_COLLATION; - n->args = NIL; n->defnames = $3; n->definition = list_make1(makeDefElem("from", (Node *) $5, @5)); $$ = (Node *)n; @@ -5818,7 +5710,6 @@ DefineStmt: { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_COLLATION; - n->args = NIL; n->defnames = $6; n->definition = list_make1(makeDefElem("from", (Node *) $8, @8)); n->if_not_exists = true; @@ -5892,9 +5783,7 @@ AlterEnumStmt: { AlterEnumStmt *n = makeNode(AlterEnumStmt); n->typeName = $3; - n->oldVal = NULL; n->newVal = $7; - n->newValNeighbor = NULL; n->newValIsAfter = true; n->skipIfNewValExists = $6; $$ = (Node *) n; @@ -5903,10 +5792,8 @@ AlterEnumStmt: { AlterEnumStmt *n = makeNode(AlterEnumStmt); n->typeName = $3; - n->oldVal = NULL; n->newVal = $7; n->newValNeighbor = $9; - n->newValIsAfter = false; n->skipIfNewValExists = $6; $$ = (Node *) n; } @@ -5914,7 +5801,6 @@ AlterEnumStmt: { AlterEnumStmt *n = makeNode(AlterEnumStmt); n->typeName = $3; - n->oldVal = NULL; n->newVal = $7; n->newValNeighbor = $9; n->newValIsAfter = true; @@ -5927,9 +5813,6 @@ AlterEnumStmt: n->typeName = $3; n->oldVal = $6; n->newVal = $8; - n->newValNeighbor = NULL; - n->newValIsAfter = false; - n->skipIfNewValExists = false; $$ = (Node *) n; } ; @@ -7253,7 +7136,6 @@ DefACLAction: n->privileges = $2; n->targtype = ACL_TARGET_DEFAULTS; n->objtype = $4; - n->objects = NIL; n->grantees = $6; n->grant_option = $7; $$ = (Node*)n; @@ -7267,7 +7149,6 @@ DefACLAction: n->privileges = $2; n->targtype = ACL_TARGET_DEFAULTS; n->objtype = $4; - n->objects = NIL; n->grantees = $6; n->behavior = $7; $$ = (Node *)n; @@ -7281,7 +7162,6 @@ DefACLAction: n->privileges = $5; n->targtype = ACL_TARGET_DEFAULTS; n->objtype = $7; - n->objects = NIL; n->grantees = $9; n->behavior = $10; $$ = (Node *)n; @@ -7321,19 +7201,6 @@ IndexStmt: CREATE opt_unique INDEX opt_concurrently opt_index_name n->options = $13; n->tableSpace = $14; n->whereClause = $15; - n->excludeOpNames = NIL; - n->idxcomment = NULL; - n->indexOid = InvalidOid; - n->oldNode = InvalidOid; - n->oldCreateSubid = InvalidSubTransactionId; - n->oldFirstRelfilenodeSubid = InvalidSubTransactionId; - n->primary = false; - n->isconstraint = false; - n->deferrable = false; - n->initdeferred = false; - n->transformed = false; - n->if_not_exists = false; - n->reset_default_tblspc = false; $$ = (Node *)n; } | CREATE opt_unique INDEX opt_concurrently IF_P NOT EXISTS name @@ -7351,19 +7218,7 @@ IndexStmt: CREATE opt_unique INDEX opt_concurrently opt_index_name n->options = $16; n->tableSpace = $17; n->whereClause = $18; - n->excludeOpNames = NIL; - n->idxcomment = NULL; - n->indexOid = InvalidOid; - n->oldNode = InvalidOid; - n->oldCreateSubid = InvalidSubTransactionId; - n->oldFirstRelfilenodeSubid = InvalidSubTransactionId; - n->primary = false; - n->isconstraint = false; - n->deferrable = false; - n->initdeferred = false; - n->transformed = false; n->if_not_exists = true; - n->reset_default_tblspc = false; $$ = (Node *)n; } ; @@ -7397,21 +7252,14 @@ index_elem_options: opt_collate opt_class opt_asc_desc opt_nulls_order { $$ = makeNode(IndexElem); - $$->name = NULL; - $$->expr = NULL; - $$->indexcolname = NULL; $$->collation = $1; $$->opclass = $2; - $$->opclassopts = NIL; $$->ordering = $3; $$->nulls_ordering = $4; } | opt_collate any_name reloptions opt_asc_desc opt_nulls_order { $$ = makeNode(IndexElem); - $$->name = NULL; - $$->expr = NULL; - $$->indexcolname = NULL; $$->collation = $1; $$->opclass = $2; $$->opclassopts = $3; @@ -7516,7 +7364,6 @@ CreateFunctionStmt: n->replace = $2; n->funcname = $4; n->parameters = $5; - n->returnType = NULL; n->options = $6; n->sql_body = $7; $$ = (Node *)n; @@ -7529,7 +7376,6 @@ CreateFunctionStmt: n->replace = $2; n->funcname = $4; n->parameters = $5; - n->returnType = NULL; n->options = $6; n->sql_body = $7; $$ = (Node *)n; @@ -7626,7 +7472,6 @@ func_arg: n->name = $2; n->argType = $3; n->mode = $1; - n->defexpr = NULL; $$ = n; } | param_name arg_class func_type @@ -7635,7 +7480,6 @@ func_arg: n->name = $1; n->argType = $3; n->mode = $2; - n->defexpr = NULL; $$ = n; } | param_name func_type @@ -7644,22 +7488,18 @@ func_arg: n->name = $1; n->argType = $2; n->mode = FUNC_PARAM_DEFAULT; - n->defexpr = NULL; $$ = n; } | arg_class func_type { FunctionParameter *n = makeNode(FunctionParameter); - n->name = NULL; n->argType = $2; n->mode = $1; - n->defexpr = NULL; $$ = n; } | func_type { FunctionParameter *n = makeNode(FunctionParameter); - n->name = NULL; n->argType = $1; n->mode = FUNC_PARAM_DEFAULT; n->defexpr = NULL; @@ -7995,7 +7835,6 @@ table_func_column: param_name func_type n->name = $1; n->argType = $2; n->mode = FUNC_PARAM_TABLE; - n->defexpr = NULL; $$ = n; } ; @@ -8379,8 +8218,6 @@ ReindexStmt: ReindexStmt *n = makeNode(ReindexStmt); n->kind = $2; n->relation = $4; - n->name = NULL; - n->params = NIL; if ($3) n->params = lappend(n->params, makeDefElem("concurrently", NULL, @3)); @@ -8391,8 +8228,6 @@ ReindexStmt: ReindexStmt *n = makeNode(ReindexStmt); n->kind = $2; n->name = $4; - n->relation = NULL; - n->params = NIL; if ($3) n->params = lappend(n->params, makeDefElem("concurrently", NULL, @3)); @@ -8403,7 +8238,6 @@ ReindexStmt: ReindexStmt *n = makeNode(ReindexStmt); n->kind = $5; n->relation = $7; - n->name = NULL; n->params = $3; if ($6) n->params = lappend(n->params, @@ -8415,7 +8249,6 @@ ReindexStmt: ReindexStmt *n = makeNode(ReindexStmt); n->kind = $5; n->name = $7; - n->relation = NULL; n->params = $3; if ($6) n->params = lappend(n->params, @@ -8472,7 +8305,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_AGGREGATE; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER COLLATION any_name RENAME TO name @@ -8481,7 +8313,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_COLLATION; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER CONVERSION_P any_name RENAME TO name @@ -8490,7 +8321,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_CONVERSION; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER DATABASE name RENAME TO name @@ -8499,7 +8329,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_DATABASE; n->subname = $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER DOMAIN_P any_name RENAME TO name @@ -8508,7 +8337,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_DOMAIN; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER DOMAIN_P any_name RENAME CONSTRAINT name TO name @@ -8526,7 +8354,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_FDW; n->object = (Node *) makeString($5); n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER FUNCTION function_with_argtypes RENAME TO name @@ -8535,7 +8362,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_FUNCTION; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER GROUP_P RoleId RENAME TO RoleId @@ -8544,7 +8370,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_ROLE; n->subname = $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER opt_procedural LANGUAGE name RENAME TO name @@ -8553,7 +8378,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_LANGUAGE; n->object = (Node *) makeString($4); n->newname = $7; - n->missing_ok = false; $$ = (Node *)n; } | ALTER OPERATOR CLASS any_name USING name RENAME TO name @@ -8562,7 +8386,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_OPCLASS; n->object = (Node *) lcons(makeString($6), $4); n->newname = $9; - n->missing_ok = false; $$ = (Node *)n; } | ALTER OPERATOR FAMILY any_name USING name RENAME TO name @@ -8571,7 +8394,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_OPFAMILY; n->object = (Node *) lcons(makeString($6), $4); n->newname = $9; - n->missing_ok = false; $$ = (Node *)n; } | ALTER POLICY name ON qualified_name RENAME TO name @@ -8581,7 +8403,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->relation = $5; n->subname = $3; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER POLICY IF_P EXISTS name ON qualified_name RENAME TO name @@ -8600,7 +8421,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_PROCEDURE; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER PUBLICATION name RENAME TO name @@ -8609,7 +8429,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_PUBLICATION; n->object = (Node *) makeString($3); n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER ROUTINE function_with_argtypes RENAME TO name @@ -8618,7 +8437,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_ROUTINE; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER SCHEMA name RENAME TO name @@ -8627,7 +8445,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_SCHEMA; n->subname = $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER SERVER name RENAME TO name @@ -8636,7 +8453,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_FOREIGN_SERVER; n->object = (Node *) makeString($3); n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER SUBSCRIPTION name RENAME TO name @@ -8645,7 +8461,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_SUBSCRIPTION; n->object = (Node *) makeString($3); n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TABLE relation_expr RENAME TO name @@ -8653,9 +8468,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_TABLE; n->relation = $3; - n->subname = NULL; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TABLE IF_P EXISTS relation_expr RENAME TO name @@ -8663,7 +8476,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_TABLE; n->relation = $5; - n->subname = NULL; n->newname = $8; n->missing_ok = true; $$ = (Node *)n; @@ -8673,9 +8485,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_SEQUENCE; n->relation = $3; - n->subname = NULL; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER SEQUENCE IF_P EXISTS qualified_name RENAME TO name @@ -8683,7 +8493,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_SEQUENCE; n->relation = $5; - n->subname = NULL; n->newname = $8; n->missing_ok = true; $$ = (Node *)n; @@ -8693,9 +8502,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_VIEW; n->relation = $3; - n->subname = NULL; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER VIEW IF_P EXISTS qualified_name RENAME TO name @@ -8703,7 +8510,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_VIEW; n->relation = $5; - n->subname = NULL; n->newname = $8; n->missing_ok = true; $$ = (Node *)n; @@ -8713,9 +8519,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_MATVIEW; n->relation = $4; - n->subname = NULL; n->newname = $7; - n->missing_ok = false; $$ = (Node *)n; } | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME TO name @@ -8723,7 +8527,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_MATVIEW; n->relation = $6; - n->subname = NULL; n->newname = $9; n->missing_ok = true; $$ = (Node *)n; @@ -8733,9 +8536,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_INDEX; n->relation = $3; - n->subname = NULL; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER INDEX IF_P EXISTS qualified_name RENAME TO name @@ -8743,7 +8544,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_INDEX; n->relation = $5; - n->subname = NULL; n->newname = $8; n->missing_ok = true; $$ = (Node *)n; @@ -8753,9 +8553,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_FOREIGN_TABLE; n->relation = $4; - n->subname = NULL; n->newname = $7; - n->missing_ok = false; $$ = (Node *)n; } | ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME TO name @@ -8763,7 +8561,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name RenameStmt *n = makeNode(RenameStmt); n->renameType = OBJECT_FOREIGN_TABLE; n->relation = $6; - n->subname = NULL; n->newname = $9; n->missing_ok = true; $$ = (Node *)n; @@ -8776,7 +8573,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->relation = $3; n->subname = $6; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TABLE IF_P EXISTS relation_expr RENAME opt_column name TO name @@ -8820,7 +8616,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->relation = $4; n->subname = $7; n->newname = $9; - n->missing_ok = false; $$ = (Node *)n; } | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME opt_column name TO name @@ -8841,7 +8636,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->relation = $3; n->subname = $6; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TABLE IF_P EXISTS relation_expr RENAME CONSTRAINT name TO name @@ -8862,7 +8656,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->relation = $4; n->subname = $7; n->newname = $9; - n->missing_ok = false; $$ = (Node *)n; } | ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME opt_column name TO name @@ -8883,7 +8676,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->relation = $5; n->subname = $3; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TRIGGER name ON qualified_name RENAME TO name @@ -8893,7 +8685,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->relation = $5; n->subname = $3; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER EVENT TRIGGER name RENAME TO name @@ -8910,7 +8701,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_ROLE; n->subname = $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER USER RoleId RENAME TO RoleId @@ -8919,7 +8709,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_ROLE; n->subname = $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TABLESPACE name RENAME TO name @@ -8928,7 +8717,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_TABLESPACE; n->subname = $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER STATISTICS any_name RENAME TO name @@ -8937,7 +8725,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_STATISTIC_EXT; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TEXT_P SEARCH PARSER any_name RENAME TO name @@ -8946,7 +8733,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_TSPARSER; n->object = (Node *) $5; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TEXT_P SEARCH DICTIONARY any_name RENAME TO name @@ -8955,7 +8741,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_TSDICTIONARY; n->object = (Node *) $5; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TEXT_P SEARCH TEMPLATE any_name RENAME TO name @@ -8964,7 +8749,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_TSTEMPLATE; n->object = (Node *) $5; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TEXT_P SEARCH CONFIGURATION any_name RENAME TO name @@ -8973,7 +8757,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_TSCONFIGURATION; n->object = (Node *) $5; n->newname = $8; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TYPE_P any_name RENAME TO name @@ -8982,7 +8765,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->renameType = OBJECT_TYPE; n->object = (Node *) $3; n->newname = $6; - n->missing_ok = false; $$ = (Node *)n; } | ALTER TYPE_P any_name RENAME ATTRIBUTE name TO name opt_drop_behavior @@ -8994,7 +8776,6 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name n->subname = $6; n->newname = $8; n->behavior = $9; - n->missing_ok = false; $$ = (Node *)n; } ; @@ -11062,8 +10843,6 @@ opt_on_conflict: $$ = makeNode(OnConflictClause); $$->action = ONCONFLICT_NOTHING; $$->infer = $3; - $$->targetList = NIL; - $$->whereClause = NULL; $$->location = @1; } | /*EMPTY*/ @@ -11078,15 +10857,12 @@ opt_conf_expr: $$ = makeNode(InferClause); $$->indexElems = $2; $$->whereClause = $4; - $$->conname = NULL; $$->location = @1; } | ON CONSTRAINT name { $$ = makeNode(InferClause); - $$->indexElems = NIL; - $$->whereClause = NULL; $$->conname = $3; $$->location = @1; } @@ -11479,8 +11255,6 @@ simple_select: cr->fields = list_make1(makeNode(A_Star)); cr->location = -1; - rt->name = NULL; - rt->indirection = NIL; rt->val = (Node *)cr; rt->location = -1; @@ -11623,12 +11397,6 @@ into_clause: { $$ = makeNode(IntoClause); $$->rel = $2; - $$->colNames = NIL; - $$->options = NIL; - $$->onCommit = ONCOMMIT_NOOP; - $$->tableSpaceName = NULL; - $$->viewQuery = NULL; - $$->skipData = false; } | /*EMPTY*/ { $$ = NULL; } @@ -12581,16 +12349,8 @@ TableFuncElement: ColId Typename opt_collate_clause ColumnDef *n = makeNode(ColumnDef); n->colname = $1; n->typeName = $2; - n->inhcount = 0; n->is_local = true; - n->is_not_null = false; - n->is_from_type = false; - n->storage = 0; - n->raw_default = NULL; - n->cooked_default = NULL; n->collClause = (CollateClause *) $3; - n->collOid = InvalidOid; - n->constraints = NIL; n->location = @1; $$ = (Node *)n; } @@ -12633,11 +12393,7 @@ xmltable_column_el: RangeTableFuncCol *fc = makeNode(RangeTableFuncCol); fc->colname = $1; - fc->for_ordinality = false; fc->typeName = $2; - fc->is_not_null = false; - fc->colexpr = NULL; - fc->coldefexpr = NULL; fc->location = @1; $$ = (Node *) fc; @@ -12650,10 +12406,6 @@ xmltable_column_el: fc->colname = $1; fc->typeName = $2; - fc->for_ordinality = false; - fc->is_not_null = false; - fc->colexpr = NULL; - fc->coldefexpr = NULL; fc->location = @1; foreach(option, $3) @@ -12742,7 +12494,6 @@ xml_namespace_el: { $$ = makeNode(ResTarget); $$->name = $3; - $$->indirection = NIL; $$->val = $1; $$->location = @1; } @@ -12750,7 +12501,6 @@ xml_namespace_el: { $$ = makeNode(ResTarget); $$->name = NULL; - $$->indirection = NIL; $$->val = $2; $$->location = @1; } @@ -13797,9 +13547,6 @@ c_expr: columnref { $$ = $1; } { SubLink *n = makeNode(SubLink); n->subLinkType = EXPR_SUBLINK; - n->subLinkId = 0; - n->testexpr = NULL; - n->operName = NIL; n->subselect = $1; n->location = @1; $$ = (Node *)n; @@ -13819,9 +13566,6 @@ c_expr: columnref { $$ = $1; } SubLink *n = makeNode(SubLink); A_Indirection *a = makeNode(A_Indirection); n->subLinkType = EXPR_SUBLINK; - n->subLinkId = 0; - n->testexpr = NULL; - n->operName = NIL; n->subselect = $1; n->location = @1; a->arg = (Node *)n; @@ -13832,9 +13576,6 @@ c_expr: columnref { $$ = $1; } { SubLink *n = makeNode(SubLink); n->subLinkType = EXISTS_SUBLINK; - n->subLinkId = 0; - n->testexpr = NULL; - n->operName = NIL; n->subselect = $2; n->location = @1; $$ = (Node *)n; @@ -13843,9 +13584,6 @@ c_expr: columnref { $$ = $1; } { SubLink *n = makeNode(SubLink); n->subLinkType = ARRAY_SUBLINK; - n->subLinkId = 0; - n->testexpr = NULL; - n->operName = NIL; n->subselect = $2; n->location = @1; $$ = (Node *)n; @@ -14336,7 +14074,6 @@ xml_attribute_el: a_expr AS ColLabel { $$ = makeNode(ResTarget); $$->name = $3; - $$->indirection = NIL; $$->val = (Node *) $1; $$->location = @1; } @@ -14344,7 +14081,6 @@ xml_attribute_el: a_expr AS ColLabel { $$ = makeNode(ResTarget); $$->name = NULL; - $$->indirection = NIL; $$->val = (Node *) $1; $$->location = @1; } @@ -14428,12 +14164,7 @@ over_clause: OVER window_specification { WindowDef *n = makeNode(WindowDef); n->name = $2; - n->refname = NULL; - n->partitionClause = NIL; - n->orderClause = NIL; n->frameOptions = FRAMEOPTION_DEFAULTS; - n->startOffset = NULL; - n->endOffset = NULL; n->location = @2; $$ = n; } @@ -14445,7 +14176,6 @@ window_specification: '(' opt_existing_window_name opt_partition_clause opt_sort_clause opt_frame_clause ')' { WindowDef *n = makeNode(WindowDef); - n->name = NULL; n->refname = $2; n->partitionClause = $3; n->orderClause = $4; @@ -14506,8 +14236,6 @@ opt_frame_clause: { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_DEFAULTS; - n->startOffset = NULL; - n->endOffset = NULL; $$ = n; } ; @@ -14578,24 +14306,18 @@ frame_bound: { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_START_UNBOUNDED_PRECEDING; - n->startOffset = NULL; - n->endOffset = NULL; $$ = n; } | UNBOUNDED FOLLOWING { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_START_UNBOUNDED_FOLLOWING; - n->startOffset = NULL; - n->endOffset = NULL; $$ = n; } | CURRENT_P ROW { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_START_CURRENT_ROW; - n->startOffset = NULL; - n->endOffset = NULL; $$ = n; } | a_expr PRECEDING @@ -15022,7 +14744,6 @@ target_el: a_expr AS ColLabel { $$ = makeNode(ResTarget); $$->name = $3; - $$->indirection = NIL; $$->val = (Node *)$1; $$->location = @1; } @@ -15030,7 +14751,6 @@ target_el: a_expr AS ColLabel { $$ = makeNode(ResTarget); $$->name = $2; - $$->indirection = NIL; $$->val = (Node *)$1; $$->location = @1; } @@ -15038,7 +14758,6 @@ target_el: a_expr AS ColLabel { $$ = makeNode(ResTarget); $$->name = NULL; - $$->indirection = NIL; $$->val = (Node *)$1; $$->location = @1; } @@ -15050,7 +14769,6 @@ target_el: a_expr AS ColLabel $$ = makeNode(ResTarget); $$->name = NULL; - $$->indirection = NIL; $$->val = (Node *)n; $$->location = @1; } @@ -17222,8 +16940,6 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query) { ResTarget *rt = makeNode(ResTarget); - rt->name = NULL; - rt->indirection = NIL; rt->val = makeColumnRef(strVal(lfirst(lc)), NIL, -1, 0); rt->location = -1; diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index 71c360bea5..0044d7e9cd 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -994,8 +994,6 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts) assign_expr_collations(pstate, arg); tablesample->repeatable = (Expr *) arg; } - else - tablesample->repeatable = NULL; return tablesample; } diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index f928c32311..8586f7016e 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -2255,8 +2255,6 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x) newx->op = x->op; if (x->name) newx->name = map_sql_identifier_to_xml_name(x->name, false, false); - else - newx->name = NULL; newx->xmloption = x->xmloption; newx->type = XMLOID; /* this just marks the node as transformed */ newx->typmod = -1; diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index 7465919044..0ec5121dd5 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -1447,16 +1447,9 @@ addRangeTableEntry(ParseState *pstate, * The initial default on access checks is always check-for-READ-access, * which is the right thing for all except target tables. */ - rte->lateral = false; rte->inh = inh; rte->inFromCl = inFromCl; - rte->requiredPerms = ACL_SELECT; - rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ - rte->selectedCols = NULL; - rte->insertedCols = NULL; - rte->updatedCols = NULL; - rte->extraUpdatedCols = NULL; /* * Add completed RTE to pstate's range table list, so that we know its @@ -1535,16 +1528,9 @@ addRangeTableEntryForRelation(ParseState *pstate, * The initial default on access checks is always check-for-READ-access, * which is the right thing for all except target tables. */ - rte->lateral = false; rte->inh = inh; rte->inFromCl = inFromCl; - rte->requiredPerms = ACL_SELECT; - rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ - rte->selectedCols = NULL; - rte->insertedCols = NULL; - rte->updatedCols = NULL; - rte->extraUpdatedCols = NULL; /* * Add completed RTE to pstate's range table list, so that we know its @@ -1633,16 +1619,8 @@ addRangeTableEntryForSubquery(ParseState *pstate, * Subqueries are never checked for access rights. */ rte->lateral = lateral; - rte->inh = false; /* never true for subqueries */ rte->inFromCl = inFromCl; - rte->requiredPerms = 0; - rte->checkAsUser = InvalidOid; - rte->selectedCols = NULL; - rte->insertedCols = NULL; - rte->updatedCols = NULL; - rte->extraUpdatedCols = NULL; - /* * Add completed RTE to pstate's range table list, so that we know its * index. But we don't add it to the join list --- caller must do that if @@ -1692,9 +1670,6 @@ addRangeTableEntryForFunction(ParseState *pstate, Assert(pstate != NULL); rte->rtekind = RTE_FUNCTION; - rte->relid = InvalidOid; - rte->subquery = NULL; - rte->functions = NIL; /* we'll fill this list below */ rte->funcordinality = rangefunc->ordinality; rte->alias = alias; @@ -1727,11 +1702,6 @@ addRangeTableEntryForFunction(ParseState *pstate, /* Initialize RangeTblFunction node */ rtfunc->funcexpr = funcexpr; - rtfunc->funccolnames = NIL; - rtfunc->funccoltypes = NIL; - rtfunc->funccoltypmods = NIL; - rtfunc->funccolcollations = NIL; - rtfunc->funcparams = NULL; /* not set until planning */ /* * Now determine if the function returns a simple or composite type. @@ -1939,16 +1909,8 @@ addRangeTableEntryForFunction(ParseState *pstate, * permissions mechanism). */ rte->lateral = lateral; - rte->inh = false; /* never true for functions */ rte->inFromCl = inFromCl; - rte->requiredPerms = 0; - rte->checkAsUser = InvalidOid; - rte->selectedCols = NULL; - rte->insertedCols = NULL; - rte->updatedCols = NULL; - rte->extraUpdatedCols = NULL; - /* * Add completed RTE to pstate's range table list, so that we know its * index. But we don't add it to the join list --- caller must do that if @@ -1985,8 +1947,6 @@ addRangeTableEntryForTableFunc(ParseState *pstate, Assert(pstate != NULL); rte->rtekind = RTE_TABLEFUNC; - rte->relid = InvalidOid; - rte->subquery = NULL; rte->tablefunc = tf; rte->coltypes = tf->coltypes; rte->coltypmods = tf->coltypmods; @@ -2010,16 +1970,8 @@ addRangeTableEntryForTableFunc(ParseState *pstate, * RTE permissions mechanism). */ rte->lateral = lateral; - rte->inh = false; /* never true for tablefunc RTEs */ rte->inFromCl = inFromCl; - rte->requiredPerms = 0; - rte->checkAsUser = InvalidOid; - rte->selectedCols = NULL; - rte->insertedCols = NULL; - rte->updatedCols = NULL; - rte->extraUpdatedCols = NULL; - /* * Add completed RTE to pstate's range table list, so that we know its * index. But we don't add it to the join list --- caller must do that if @@ -2061,8 +2013,6 @@ addRangeTableEntryForValues(ParseState *pstate, Assert(pstate != NULL); rte->rtekind = RTE_VALUES; - rte->relid = InvalidOid; - rte->subquery = NULL; rte->values_lists = exprs; rte->coltypes = coltypes; rte->coltypmods = coltypmods; @@ -2097,16 +2047,8 @@ addRangeTableEntryForValues(ParseState *pstate, * Subqueries are never checked for access rights. */ rte->lateral = lateral; - rte->inh = false; /* never true for values RTEs */ rte->inFromCl = inFromCl; - rte->requiredPerms = 0; - rte->checkAsUser = InvalidOid; - rte->selectedCols = NULL; - rte->insertedCols = NULL; - rte->updatedCols = NULL; - rte->extraUpdatedCols = NULL; - /* * Add completed RTE to pstate's range table list, so that we know its * index. But we don't add it to the join list --- caller must do that if @@ -2162,8 +2104,6 @@ addRangeTableEntryForJoin(ParseState *pstate, MaxAttrNumber))); rte->rtekind = RTE_JOIN; - rte->relid = InvalidOid; - rte->subquery = NULL; rte->jointype = jointype; rte->joinmergedcols = nummergedcols; rte->joinaliasvars = aliasvars; @@ -2187,17 +2127,8 @@ addRangeTableEntryForJoin(ParseState *pstate, * * Joins are never checked for access rights. */ - rte->lateral = false; - rte->inh = false; /* never true for joins */ rte->inFromCl = inFromCl; - rte->requiredPerms = 0; - rte->checkAsUser = InvalidOid; - rte->selectedCols = NULL; - rte->insertedCols = NULL; - rte->updatedCols = NULL; - rte->extraUpdatedCols = NULL; - /* * Add completed RTE to pstate's range table list, so that we know its * index. But we don't add it to the join list --- caller must do that if @@ -2335,19 +2266,10 @@ addRangeTableEntryForCTE(ParseState *pstate, /* * Set flags and access permissions. * - * Subqueries are never checked for access rights. + * CTEs are never checked for access rights. */ - rte->lateral = false; - rte->inh = false; /* never true for subqueries */ rte->inFromCl = inFromCl; - rte->requiredPerms = 0; - rte->checkAsUser = InvalidOid; - rte->selectedCols = NULL; - rte->insertedCols = NULL; - rte->updatedCols = NULL; - rte->extraUpdatedCols = NULL; - /* * Add completed RTE to pstate's range table list, so that we know its * index. But we don't add it to the join list --- caller must do that if @@ -2463,14 +2385,8 @@ addRangeTableEntryForENR(ParseState *pstate, * * ENRs are never checked for access rights. */ - rte->lateral = false; - rte->inh = false; /* never true for ENRs */ rte->inFromCl = inFromCl; - rte->requiredPerms = 0; - rte->checkAsUser = InvalidOid; - rte->selectedCols = NULL; - /* * Add completed RTE to pstate's range table list, so that we know its * index. But we don't add it to the join list --- caller must do that if diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 81d3e7990c..6c24dfc396 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -619,7 +619,6 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column) constraint->contype = CONSTR_DEFAULT; constraint->location = -1; constraint->raw_expr = (Node *) funccallnode; - constraint->cooked_expr = NULL; column->constraints = lappend(column->constraints, constraint); constraint = makeNode(Constraint); @@ -1032,16 +1031,9 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla def->colname = pstrdup(attributeName); def->typeName = makeTypeNameFromOid(attribute->atttypid, attribute->atttypmod); - def->inhcount = 0; def->is_local = true; def->is_not_null = attribute->attnotnull; - def->is_from_type = false; - def->storage = 0; - def->raw_default = NULL; - def->cooked_default = NULL; - def->collClause = NULL; def->collOid = attribute->attcollation; - def->constraints = NIL; def->location = -1; /* @@ -1341,7 +1333,6 @@ expandTableLikeClause(RangeVar *heapRel, TableLikeClause *table_like_clause) n->conname = pstrdup(ccname); n->location = -1; n->is_no_inherit = ccnoinherit; - n->raw_expr = NULL; n->cooked_expr = nodeToString(ccbin_node); /* We can skip validation, since the new table should be empty. */ @@ -1472,16 +1463,9 @@ transformOfType(CreateStmtContext *cxt, TypeName *ofTypename) n = makeNode(ColumnDef); n->colname = pstrdup(NameStr(attr->attname)); n->typeName = makeTypeNameFromOid(attr->atttypid, attr->atttypmod); - n->inhcount = 0; n->is_local = true; - n->is_not_null = false; n->is_from_type = true; - n->storage = 0; - n->raw_default = NULL; - n->cooked_default = NULL; - n->collClause = NULL; n->collOid = attr->attcollation; - n->constraints = NIL; n->location = -1; cxt->columns = lappend(cxt->columns, n); } @@ -1573,20 +1557,9 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, index->accessMethod = pstrdup(NameStr(amrec->amname)); if (OidIsValid(idxrelrec->reltablespace)) index->tableSpace = get_tablespace_name(idxrelrec->reltablespace); - else - index->tableSpace = NULL; - index->excludeOpNames = NIL; - index->idxcomment = NULL; - index->indexOid = InvalidOid; - index->oldNode = InvalidOid; - index->oldCreateSubid = InvalidSubTransactionId; - index->oldFirstRelfilenodeSubid = InvalidSubTransactionId; index->unique = idxrec->indisunique; index->primary = idxrec->indisprimary; index->transformed = true; /* don't need transformIndexStmt */ - index->concurrent = false; - index->if_not_exists = false; - index->reset_default_tblspc = false; /* * We don't try to preserve the name of the source index; instead, just @@ -1716,7 +1689,6 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, keycoltype = get_atttype(indrelid, attnum); iparam->name = attname; - iparam->expr = NULL; } else { @@ -1743,7 +1715,6 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, errdetail("Index \"%s\" contains a whole-row table reference.", RelationGetRelationName(source_idx)))); - iparam->name = NULL; iparam->expr = indexkey; keycoltype = exprType(indexkey); @@ -1806,7 +1777,6 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, attname = get_attname(indrelid, attnum, false); iparam->name = attname; - iparam->expr = NULL; } else ereport(ERROR, @@ -1965,13 +1935,10 @@ generateClonedExtStatsStmt(RangeVar *heapRel, Oid heapRelid, /* finally, build the output node */ stats = makeNode(CreateStatsStmt); - stats->defnames = NULL; stats->stat_types = stat_types; stats->exprs = def_names; stats->relations = list_make1(heapRel); - stats->stxcomment = NULL; stats->transformed = true; /* don't need transformStatsStmt again */ - stats->if_not_exists = false; /* Clean up */ ReleaseSysCache(ht_stats); @@ -2193,17 +2160,6 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) index->options = constraint->options; index->tableSpace = constraint->indexspace; index->whereClause = constraint->where_clause; - index->indexParams = NIL; - index->indexIncludingParams = NIL; - index->excludeOpNames = NIL; - index->idxcomment = NULL; - index->indexOid = InvalidOid; - index->oldNode = InvalidOid; - index->oldCreateSubid = InvalidSubTransactionId; - index->oldFirstRelfilenodeSubid = InvalidSubTransactionId; - index->transformed = false; - index->concurrent = false; - index->if_not_exists = false; index->reset_default_tblspc = constraint->reset_default_tblspc; /* @@ -2539,11 +2495,6 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) /* OK, add it to the index definition */ iparam = makeNode(IndexElem); iparam->name = pstrdup(key); - iparam->expr = NULL; - iparam->indexcolname = NULL; - iparam->collation = NIL; - iparam->opclass = NIL; - iparam->opclassopts = NIL; iparam->ordering = SORTBY_DEFAULT; iparam->nulls_ordering = SORTBY_NULLS_DEFAULT; index->indexParams = lappend(index->indexParams, iparam); @@ -2653,11 +2604,6 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) /* OK, add it to the index definition */ iparam = makeNode(IndexElem); iparam->name = pstrdup(key); - iparam->expr = NULL; - iparam->indexcolname = NULL; - iparam->collation = NIL; - iparam->opclass = NIL; - iparam->opclassopts = NIL; index->indexIncludingParams = lappend(index->indexIncludingParams, iparam); } @@ -2781,7 +2727,6 @@ transformFKConstraints(CreateStmtContext *cxt, AlterTableCmd *altercmd = makeNode(AlterTableCmd); altercmd->subtype = AT_AddConstraint; - altercmd->name = NULL; altercmd->def = (Node *) constraint; alterstmt->cmds = lappend(alterstmt->cmds, altercmd); } diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 3719755a0d..a22e8d0ae1 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -1040,9 +1040,6 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) /* Build two-element rtable */ memset(&dpns, 0, sizeof(dpns)); dpns.rtable = list_make2(oldrte, newrte); - dpns.subplans = NIL; - dpns.ctes = NIL; - dpns.appendrels = NULL; set_rtable_names(&dpns, NIL, NULL); set_simple_column_names(&dpns); @@ -3603,7 +3600,6 @@ deparse_context_for_plan_tree(PlannedStmt *pstmt, List *rtable_names) dpns->rtable = pstmt->rtable; dpns->rtable_names = rtable_names; dpns->subplans = pstmt->subplans; - dpns->ctes = NIL; if (pstmt->appendRelations) { /* Set up the array, indexed by child relid */ @@ -3622,8 +3618,6 @@ deparse_context_for_plan_tree(PlannedStmt *pstmt, List *rtable_names) dpns->appendrels[crelid] = appinfo; } } - else - dpns->appendrels = NULL; /* don't need it */ /* * Set up column name aliases. We will get rather bogus results for join @@ -3691,9 +3685,6 @@ select_rtable_names_for_explain(List *rtable, Bitmapset *rels_used) memset(&dpns, 0, sizeof(dpns)); dpns.rtable = rtable; - dpns.subplans = NIL; - dpns.ctes = NIL; - dpns.appendrels = NULL; set_rtable_names(&dpns, NIL, rels_used); /* We needn't bother computing column aliases yet */ diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c index 07b0145132..9ad46ece33 100644 --- a/src/backend/utils/cache/plancache.c +++ b/src/backend/utils/cache/plancache.c @@ -194,32 +194,8 @@ CreateCachedPlan(RawStmt *raw_parse_tree, plansource->query_string = pstrdup(query_string); MemoryContextSetIdentifier(source_context, plansource->query_string); plansource->commandTag = commandTag; - plansource->param_types = NULL; - plansource->num_params = 0; - plansource->parserSetup = NULL; - plansource->parserSetupArg = NULL; - plansource->cursor_options = 0; - plansource->fixed_result = false; - plansource->resultDesc = NULL; plansource->context = source_context; - plansource->query_list = NIL; - plansource->relationOids = NIL; - plansource->invalItems = NIL; - plansource->search_path = NULL; - plansource->query_context = NULL; - plansource->rewriteRoleId = InvalidOid; - plansource->rewriteRowSecurity = false; - plansource->dependsOnRLS = false; - plansource->gplan = NULL; - plansource->is_oneshot = false; - plansource->is_complete = false; - plansource->is_saved = false; - plansource->is_valid = false; - plansource->generation = 0; plansource->generic_cost = -1; - plansource->total_custom_cost = 0; - plansource->num_generic_plans = 0; - plansource->num_custom_plans = 0; MemoryContextSwitchTo(oldcxt); @@ -262,32 +238,9 @@ CreateOneShotCachedPlan(RawStmt *raw_parse_tree, plansource->raw_parse_tree = raw_parse_tree; plansource->query_string = query_string; plansource->commandTag = commandTag; - plansource->param_types = NULL; - plansource->num_params = 0; - plansource->parserSetup = NULL; - plansource->parserSetupArg = NULL; - plansource->cursor_options = 0; - plansource->fixed_result = false; - plansource->resultDesc = NULL; plansource->context = CurrentMemoryContext; - plansource->query_list = NIL; - plansource->relationOids = NIL; - plansource->invalItems = NIL; - plansource->search_path = NULL; - plansource->query_context = NULL; - plansource->rewriteRoleId = InvalidOid; - plansource->rewriteRowSecurity = false; - plansource->dependsOnRLS = false; - plansource->gplan = NULL; plansource->is_oneshot = true; - plansource->is_complete = false; - plansource->is_saved = false; - plansource->is_valid = false; - plansource->generation = 0; plansource->generic_cost = -1; - plansource->total_custom_cost = 0; - plansource->num_generic_plans = 0; - plansource->num_custom_plans = 0; return plansource; } diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 94fbf1aa19..89e1603a69 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -397,9 +397,6 @@ AllocateRelationDesc(Form_pg_class relp) */ relation = (Relation) palloc0(sizeof(RelationData)); - /* make sure relation is marked as having no open file yet */ - relation->rd_smgr = NULL; - /* * Copy the relation tuple form * @@ -1076,12 +1073,6 @@ RelationBuildDesc(Oid targetRelId, bool insertIt) * Normal relations are not nailed into the cache. Since we don't flush * new relations, it won't be new. It could be temp though. */ - relation->rd_refcnt = 0; - relation->rd_isnailed = false; - relation->rd_createSubid = InvalidSubTransactionId; - relation->rd_newRelfilenodeSubid = InvalidSubTransactionId; - relation->rd_firstRelfilenodeSubid = InvalidSubTransactionId; - relation->rd_droppedSubid = InvalidSubTransactionId; switch (relation->rd_rel->relpersistence) { case RELPERSISTENCE_UNLOGGED: @@ -1132,37 +1123,12 @@ RelationBuildDesc(Oid targetRelId, bool insertIt) */ if (relation->rd_rel->relhasrules) RelationBuildRuleLock(relation); - else - { - relation->rd_rules = NULL; - relation->rd_rulescxt = NULL; - } if (relation->rd_rel->relhastriggers) RelationBuildTriggers(relation); - else - relation->trigdesc = NULL; if (relation->rd_rel->relrowsecurity) RelationBuildRowSecurity(relation); - else - relation->rd_rsdesc = NULL; - - /* foreign key data is not loaded till asked for */ - relation->rd_fkeylist = NIL; - relation->rd_fkeyvalid = false; - - /* partitioning data is not loaded till asked for */ - relation->rd_partkey = NULL; - relation->rd_partkeycxt = NULL; - relation->rd_partdesc = NULL; - relation->rd_partdesc_nodetached = NULL; - relation->rd_partdesc_nodetached_xmin = InvalidTransactionId; - relation->rd_pdcxt = NULL; - relation->rd_pddcxt = NULL; - relation->rd_partcheck = NIL; - relation->rd_partcheckvalid = false; - relation->rd_partcheckcxt = NULL; /* * initialize access method information @@ -1205,9 +1171,6 @@ RelationBuildDesc(Oid targetRelId, bool insertIt) */ RelationInitPhysicalAddr(relation); - /* make sure relation is marked as having no open file yet */ - relation->rd_smgr = NULL; - /* * now we can free the memory allocated for pg_class_tuple */ @@ -1814,9 +1777,6 @@ formrdesc(const char *relationName, Oid relationReltype, */ relation = (Relation) palloc0(sizeof(RelationData)); - /* make sure relation is marked as having no open file yet */ - relation->rd_smgr = NULL; - /* * initialize reference count: 1 because it is nailed in cache */ @@ -1864,9 +1824,7 @@ formrdesc(const char *relationName, Oid relationReltype, relation->rd_rel->relispopulated = true; relation->rd_rel->relreplident = REPLICA_IDENTITY_NOTHING; - relation->rd_rel->relpages = 0; relation->rd_rel->reltuples = -1; - relation->rd_rel->relallvisible = 0; relation->rd_rel->relkind = RELKIND_RELATION; relation->rd_rel->relnatts = (int16) natts; relation->rd_rel->relam = HEAP_TABLE_AM_OID; @@ -3415,9 +3373,6 @@ RelationBuildLocalRelation(const char *relname, */ rel = (Relation) palloc0(sizeof(RelationData)); - /* make sure relation is marked as having no open file yet */ - rel->rd_smgr = NULL; - /* mark it nailed if appropriate */ rel->rd_isnailed = nailit; diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 9ae851d847..4c484409a3 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -46,7 +46,7 @@ typedef struct Alias /* What to do at commit time for temporary relations */ typedef enum OnCommitAction { - ONCOMMIT_NOOP, /* No ON COMMIT clause (do nothing) */ + ONCOMMIT_NOOP = 0, /* No ON COMMIT clause (do nothing) */ ONCOMMIT_PRESERVE_ROWS, /* ON COMMIT PRESERVE ROWS (do nothing) */ ONCOMMIT_DELETE_ROWS, /* ON COMMIT DELETE ROWS */ ONCOMMIT_DROP /* ON COMMIT DROP */ base-commit: c31833779d5a4775d7220be4b9143bec66c9a9fd -- 2.32.0