mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Remove unused arg and dead code in set_attnotnull()
The is_valid parameter was never referenced in the function body, and
the 'thisatt' local variable is set but never used. Remove both.
Oversight in a379061a22.
Author: Sami Imseih <samimseih@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAA5RZ0tHnvSrfUy4jWJchjvkL_aJe0hCnZpMsFRdLrSxCne5qQ@mail.gmail.com
This commit is contained in:
@@ -501,7 +501,7 @@ static void add_column_collation_dependency(Oid relid, int32 attnum, Oid collid)
|
||||
static ObjectAddress ATExecDropNotNull(Relation rel, const char *colName, bool recurse,
|
||||
LOCKMODE lockmode);
|
||||
static void set_attnotnull(List **wqueue, Relation rel, AttrNumber attnum,
|
||||
bool is_valid, bool queue_validation);
|
||||
bool queue_validation);
|
||||
static ObjectAddress ATExecSetNotNull(List **wqueue, Relation rel,
|
||||
char *conName, char *colName,
|
||||
bool recurse, bool recursing,
|
||||
@@ -1354,7 +1354,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
|
||||
nncols = AddRelationNotNullConstraints(rel, stmt->nnconstraints,
|
||||
old_notnulls, connames);
|
||||
foreach_int(attrnum, nncols)
|
||||
set_attnotnull(NULL, rel, attrnum, true, false);
|
||||
set_attnotnull(NULL, rel, attrnum, false);
|
||||
|
||||
ObjectAddressSet(address, RelationRelationId, relationId);
|
||||
|
||||
@@ -7838,10 +7838,9 @@ ATExecDropNotNull(Relation rel, const char *colName, bool recurse,
|
||||
*/
|
||||
static void
|
||||
set_attnotnull(List **wqueue, Relation rel, AttrNumber attnum,
|
||||
bool is_valid, bool queue_validation)
|
||||
bool queue_validation)
|
||||
{
|
||||
Form_pg_attribute attr;
|
||||
CompactAttribute *thisatt;
|
||||
|
||||
Assert(!queue_validation || wqueue);
|
||||
|
||||
@@ -7867,9 +7866,6 @@ set_attnotnull(List **wqueue, Relation rel, AttrNumber attnum,
|
||||
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
|
||||
attnum, RelationGetRelid(rel));
|
||||
|
||||
thisatt = TupleDescCompactAttr(RelationGetDescr(rel), attnum - 1);
|
||||
thisatt->attnullability = ATTNULLABLE_VALID;
|
||||
|
||||
attr = (Form_pg_attribute) GETSTRUCT(tuple);
|
||||
|
||||
attr->attnotnull = true;
|
||||
@@ -8051,7 +8047,7 @@ ATExecSetNotNull(List **wqueue, Relation rel, char *conName, char *colName,
|
||||
ObjectAddressSet(address, ConstraintRelationId, ccon->conoid);
|
||||
|
||||
/* Mark pg_attribute.attnotnull for the column and queue validation */
|
||||
set_attnotnull(wqueue, rel, attnum, true, true);
|
||||
set_attnotnull(wqueue, rel, attnum, true);
|
||||
|
||||
InvokeObjectPostAlterHook(RelationRelationId,
|
||||
RelationGetRelid(rel), attnum);
|
||||
@@ -9977,7 +9973,6 @@ ATAddCheckNNConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
||||
*/
|
||||
if (constr->contype == CONSTR_NOTNULL)
|
||||
set_attnotnull(wqueue, rel, ccon->attnum,
|
||||
!constr->skip_validation,
|
||||
!constr->skip_validation);
|
||||
|
||||
ObjectAddressSet(address, ConstraintRelationId, ccon->conoid);
|
||||
@@ -13300,7 +13295,7 @@ QueueNNConstraintValidation(List **wqueue, Relation conrel, Relation rel,
|
||||
}
|
||||
|
||||
/* Set attnotnull appropriately without queueing another validation */
|
||||
set_attnotnull(NULL, rel, attnum, true, false);
|
||||
set_attnotnull(NULL, rel, attnum, false);
|
||||
|
||||
tab = ATGetQueueEntry(wqueue, rel);
|
||||
tab->verify_new_notnull = true;
|
||||
|
||||
Reference in New Issue
Block a user