diff options
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index f2947ea9b49..a2f577024a1 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8988,15 +8988,15 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, bool recurse, bool recursing, LOCKMODE lockmode) { Relation pkrel; - int16 pkattnum[INDEX_MAX_KEYS]; - int16 fkattnum[INDEX_MAX_KEYS]; - Oid pktypoid[INDEX_MAX_KEYS]; - Oid fktypoid[INDEX_MAX_KEYS]; - Oid opclasses[INDEX_MAX_KEYS]; - Oid pfeqoperators[INDEX_MAX_KEYS]; - Oid ppeqoperators[INDEX_MAX_KEYS]; - Oid ffeqoperators[INDEX_MAX_KEYS]; - int16 fkdelsetcols[INDEX_MAX_KEYS]; + int16 pkattnum[INDEX_MAX_KEYS] = {0}; + int16 fkattnum[INDEX_MAX_KEYS] = {0}; + Oid pktypoid[INDEX_MAX_KEYS] = {0}; + Oid fktypoid[INDEX_MAX_KEYS] = {0}; + Oid opclasses[INDEX_MAX_KEYS] = {0}; + Oid pfeqoperators[INDEX_MAX_KEYS] = {0}; + Oid ppeqoperators[INDEX_MAX_KEYS] = {0}; + Oid ffeqoperators[INDEX_MAX_KEYS] = {0}; + int16 fkdelsetcols[INDEX_MAX_KEYS] = {0}; int i; int numfks, numpks, @@ -9088,16 +9088,6 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, * Look up the referencing attributes to make sure they exist, and record * their attnums and type OIDs. */ - MemSet(pkattnum, 0, sizeof(pkattnum)); - MemSet(fkattnum, 0, sizeof(fkattnum)); - MemSet(pktypoid, 0, sizeof(pktypoid)); - MemSet(fktypoid, 0, sizeof(fktypoid)); - MemSet(opclasses, 0, sizeof(opclasses)); - MemSet(pfeqoperators, 0, sizeof(pfeqoperators)); - MemSet(ppeqoperators, 0, sizeof(ppeqoperators)); - MemSet(ffeqoperators, 0, sizeof(ffeqoperators)); - MemSet(fkdelsetcols, 0, sizeof(fkdelsetcols)); - numfks = transformColumnNameList(RelationGetRelid(rel), fkconstraint->fk_attrs, fkattnum, fktypoid); @@ -11473,7 +11463,7 @@ validateForeignKeyConstraint(char *conname, { TupleTableSlot *slot; TableScanDesc scan; - Trigger trig; + Trigger trig = {0}; Snapshot snapshot; MemoryContext oldcxt; MemoryContext perTupCxt; @@ -11484,7 +11474,6 @@ validateForeignKeyConstraint(char *conname, /* * Build a trigger call structure; we'll need it either way. */ - MemSet(&trig, 0, sizeof(trig)); trig.tgoid = InvalidOid; trig.tgname = conname; trig.tgenabled = TRIGGER_FIRES_ON_ORIGIN; @@ -12758,15 +12747,11 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, int one = 1; bool isNull; - Datum valuesAtt[Natts_pg_attribute]; - bool nullsAtt[Natts_pg_attribute]; - bool replacesAtt[Natts_pg_attribute]; + Datum valuesAtt[Natts_pg_attribute] = {0}; + bool nullsAtt[Natts_pg_attribute] = {0}; + bool replacesAtt[Natts_pg_attribute] = {0}; HeapTuple newTup; - MemSet(valuesAtt, 0, sizeof(valuesAtt)); - MemSet(nullsAtt, false, sizeof(nullsAtt)); - MemSet(replacesAtt, false, sizeof(replacesAtt)); - missingval = array_get_element(missingval, 1, &one, @@ -19192,7 +19177,7 @@ ATDetachCheckNoForeignKeyRefs(Relation partition) HeapTuple tuple; Form_pg_constraint constrForm; Relation rel; - Trigger trig; + Trigger trig = {0}; tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constrOid)); if (!HeapTupleIsValid(tuple)) @@ -19205,7 +19190,6 @@ ATDetachCheckNoForeignKeyRefs(Relation partition) /* prevent data changes into the referencing table until commit */ rel = table_open(constrForm->conrelid, ShareLock); - MemSet(&trig, 0, sizeof(trig)); trig.tgoid = InvalidOid; trig.tgname = NameStr(constrForm->conname); trig.tgenabled = TRIGGER_FIRES_ON_ORIGIN; |