mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Remove now-dead code in StoreAttrDefault().
StoreAttrDefault() is no longer responsible for filling attmissingval, so remove the code for that. Get rid of RawColumnDefault.missingMode, too, as we no longer need that to pass information around. While here, clean up some sloppy coding in StoreAttrDefault(), such as failure to use XXXGetDatum macros. These aren't bugs but they're not good code either. Reported-by: jian he <jian.universality@gmail.com> Author: jian he <jian.universality@gmail.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CACJufxHFssPvkP1we7WMhPD_1kwgbG52o=kQgL+TnVoX5LOyCQ@mail.gmail.com
This commit is contained in:
@ -967,7 +967,6 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
|
||||
rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault));
|
||||
rawEnt->attnum = attnum;
|
||||
rawEnt->raw_default = colDef->raw_default;
|
||||
rawEnt->missingMode = false;
|
||||
rawEnt->generated = colDef->generated;
|
||||
rawDefaults = lappend(rawDefaults, rawEnt);
|
||||
attr->atthasdef = true;
|
||||
@ -7321,7 +7320,6 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
||||
rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault));
|
||||
rawEnt->attnum = attribute->attnum;
|
||||
rawEnt->raw_default = copyObject(colDef->raw_default);
|
||||
rawEnt->missingMode = false; /* XXX vestigial */
|
||||
rawEnt->generated = colDef->generated;
|
||||
|
||||
/*
|
||||
@ -8077,7 +8075,6 @@ ATExecColumnDefault(Relation rel, const char *colName,
|
||||
rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault));
|
||||
rawEnt->attnum = attnum;
|
||||
rawEnt->raw_default = newDefault;
|
||||
rawEnt->missingMode = false;
|
||||
rawEnt->generated = '\0';
|
||||
|
||||
/*
|
||||
@ -8115,7 +8112,7 @@ ATExecCookedColumnDefault(Relation rel, AttrNumber attnum,
|
||||
RemoveAttrDefault(RelationGetRelid(rel), attnum, DROP_RESTRICT, false,
|
||||
true);
|
||||
|
||||
(void) StoreAttrDefault(rel, attnum, newDefault, true, false);
|
||||
(void) StoreAttrDefault(rel, attnum, newDefault, true);
|
||||
|
||||
ObjectAddressSubSet(address, RelationRelationId,
|
||||
RelationGetRelid(rel), attnum);
|
||||
@ -8578,7 +8575,6 @@ ATExecSetExpression(AlteredTableInfo *tab, Relation rel, const char *colName,
|
||||
rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault));
|
||||
rawEnt->attnum = attnum;
|
||||
rawEnt->raw_default = newExpr;
|
||||
rawEnt->missingMode = false;
|
||||
rawEnt->generated = attgenerated;
|
||||
|
||||
/* Store the generated expression */
|
||||
@ -14130,7 +14126,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
|
||||
RemoveAttrDefault(RelationGetRelid(rel), attnum, DROP_RESTRICT, true,
|
||||
true);
|
||||
|
||||
StoreAttrDefault(rel, attnum, defaultexpr, true, false);
|
||||
(void) StoreAttrDefault(rel, attnum, defaultexpr, true);
|
||||
}
|
||||
|
||||
ObjectAddressSubSet(address, RelationRelationId,
|
||||
|
Reference in New Issue
Block a user