mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Remove useless assertions
We don't need Assert(IsA(foo, String)) right before running strVal(foo), since strVal() already does the assertion internally (via castNode()).
This commit is contained in:
parent
7057bf2354
commit
503e3833ef
@ -8271,7 +8271,6 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue, LOCKMODE loc
|
|||||||
AttrNumber attnum;
|
AttrNumber attnum;
|
||||||
ObjectAddress address;
|
ObjectAddress address;
|
||||||
|
|
||||||
Assert(IsA(newValue, String));
|
|
||||||
storagemode = strVal(newValue);
|
storagemode = strVal(newValue);
|
||||||
|
|
||||||
if (pg_strcasecmp(storagemode, "plain") == 0)
|
if (pg_strcasecmp(storagemode, "plain") == 0)
|
||||||
@ -16171,7 +16170,6 @@ ATExecSetCompression(AlteredTableInfo *tab,
|
|||||||
char cmethod;
|
char cmethod;
|
||||||
ObjectAddress address;
|
ObjectAddress address;
|
||||||
|
|
||||||
Assert(IsA(newValue, String));
|
|
||||||
compression = strVal(newValue);
|
compression = strVal(newValue);
|
||||||
|
|
||||||
attrel = table_open(AttributeRelationId, RowExclusiveLock);
|
attrel = table_open(AttributeRelationId, RowExclusiveLock);
|
||||||
|
@ -3577,7 +3577,6 @@ replace_domain_constraint_value(ParseState *pstate, ColumnRef *cref)
|
|||||||
Node *field1 = (Node *) linitial(cref->fields);
|
Node *field1 = (Node *) linitial(cref->fields);
|
||||||
char *colname;
|
char *colname;
|
||||||
|
|
||||||
Assert(IsA(field1, String));
|
|
||||||
colname = strVal(field1);
|
colname = strVal(field1);
|
||||||
if (strcmp(colname, "value") == 0)
|
if (strcmp(colname, "value") == 0)
|
||||||
{
|
{
|
||||||
|
@ -318,12 +318,10 @@ sql_fn_post_column_ref(ParseState *pstate, ColumnRef *cref, Node *var)
|
|||||||
nnames--;
|
nnames--;
|
||||||
|
|
||||||
field1 = (Node *) linitial(cref->fields);
|
field1 = (Node *) linitial(cref->fields);
|
||||||
Assert(IsA(field1, String));
|
|
||||||
name1 = strVal(field1);
|
name1 = strVal(field1);
|
||||||
if (nnames > 1)
|
if (nnames > 1)
|
||||||
{
|
{
|
||||||
subfield = (Node *) lsecond(cref->fields);
|
subfield = (Node *) lsecond(cref->fields);
|
||||||
Assert(IsA(subfield, String));
|
|
||||||
name2 = strVal(subfield);
|
name2 = strVal(subfield);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +631,6 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
|||||||
{
|
{
|
||||||
Node *field1 = (Node *) linitial(cref->fields);
|
Node *field1 = (Node *) linitial(cref->fields);
|
||||||
|
|
||||||
Assert(IsA(field1, String));
|
|
||||||
colname = strVal(field1);
|
colname = strVal(field1);
|
||||||
|
|
||||||
/* Try to identify as an unqualified column */
|
/* Try to identify as an unqualified column */
|
||||||
@ -664,7 +663,6 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
|||||||
Node *field1 = (Node *) linitial(cref->fields);
|
Node *field1 = (Node *) linitial(cref->fields);
|
||||||
Node *field2 = (Node *) lsecond(cref->fields);
|
Node *field2 = (Node *) lsecond(cref->fields);
|
||||||
|
|
||||||
Assert(IsA(field1, String));
|
|
||||||
relname = strVal(field1);
|
relname = strVal(field1);
|
||||||
|
|
||||||
/* Locate the referenced nsitem */
|
/* Locate the referenced nsitem */
|
||||||
@ -685,7 +683,6 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert(IsA(field2, String));
|
|
||||||
colname = strVal(field2);
|
colname = strVal(field2);
|
||||||
|
|
||||||
/* Try to identify as a column of the nsitem */
|
/* Try to identify as a column of the nsitem */
|
||||||
@ -712,9 +709,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
|||||||
Node *field2 = (Node *) lsecond(cref->fields);
|
Node *field2 = (Node *) lsecond(cref->fields);
|
||||||
Node *field3 = (Node *) lthird(cref->fields);
|
Node *field3 = (Node *) lthird(cref->fields);
|
||||||
|
|
||||||
Assert(IsA(field1, String));
|
|
||||||
nspname = strVal(field1);
|
nspname = strVal(field1);
|
||||||
Assert(IsA(field2, String));
|
|
||||||
relname = strVal(field2);
|
relname = strVal(field2);
|
||||||
|
|
||||||
/* Locate the referenced nsitem */
|
/* Locate the referenced nsitem */
|
||||||
@ -735,7 +730,6 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert(IsA(field3, String));
|
|
||||||
colname = strVal(field3);
|
colname = strVal(field3);
|
||||||
|
|
||||||
/* Try to identify as a column of the nsitem */
|
/* Try to identify as a column of the nsitem */
|
||||||
@ -764,11 +758,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
|||||||
Node *field4 = (Node *) lfourth(cref->fields);
|
Node *field4 = (Node *) lfourth(cref->fields);
|
||||||
char *catname;
|
char *catname;
|
||||||
|
|
||||||
Assert(IsA(field1, String));
|
|
||||||
catname = strVal(field1);
|
catname = strVal(field1);
|
||||||
Assert(IsA(field2, String));
|
|
||||||
nspname = strVal(field2);
|
nspname = strVal(field2);
|
||||||
Assert(IsA(field3, String));
|
|
||||||
relname = strVal(field3);
|
relname = strVal(field3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -798,7 +789,6 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert(IsA(field4, String));
|
|
||||||
colname = strVal(field4);
|
colname = strVal(field4);
|
||||||
|
|
||||||
/* Try to identify as a column of the nsitem */
|
/* Try to identify as a column of the nsitem */
|
||||||
|
@ -1213,7 +1213,6 @@ resolve_column_ref(ParseState *pstate, PLpgSQL_expr *expr,
|
|||||||
{
|
{
|
||||||
Node *field1 = (Node *) linitial(cref->fields);
|
Node *field1 = (Node *) linitial(cref->fields);
|
||||||
|
|
||||||
Assert(IsA(field1, String));
|
|
||||||
name1 = strVal(field1);
|
name1 = strVal(field1);
|
||||||
nnames_scalar = 1;
|
nnames_scalar = 1;
|
||||||
nnames_wholerow = 1;
|
nnames_wholerow = 1;
|
||||||
@ -1224,7 +1223,6 @@ resolve_column_ref(ParseState *pstate, PLpgSQL_expr *expr,
|
|||||||
Node *field1 = (Node *) linitial(cref->fields);
|
Node *field1 = (Node *) linitial(cref->fields);
|
||||||
Node *field2 = (Node *) lsecond(cref->fields);
|
Node *field2 = (Node *) lsecond(cref->fields);
|
||||||
|
|
||||||
Assert(IsA(field1, String));
|
|
||||||
name1 = strVal(field1);
|
name1 = strVal(field1);
|
||||||
|
|
||||||
/* Whole-row reference? */
|
/* Whole-row reference? */
|
||||||
@ -1236,7 +1234,6 @@ resolve_column_ref(ParseState *pstate, PLpgSQL_expr *expr,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert(IsA(field2, String));
|
|
||||||
name2 = strVal(field2);
|
name2 = strVal(field2);
|
||||||
colname = name2;
|
colname = name2;
|
||||||
nnames_scalar = 2;
|
nnames_scalar = 2;
|
||||||
@ -1250,9 +1247,7 @@ resolve_column_ref(ParseState *pstate, PLpgSQL_expr *expr,
|
|||||||
Node *field2 = (Node *) lsecond(cref->fields);
|
Node *field2 = (Node *) lsecond(cref->fields);
|
||||||
Node *field3 = (Node *) lthird(cref->fields);
|
Node *field3 = (Node *) lthird(cref->fields);
|
||||||
|
|
||||||
Assert(IsA(field1, String));
|
|
||||||
name1 = strVal(field1);
|
name1 = strVal(field1);
|
||||||
Assert(IsA(field2, String));
|
|
||||||
name2 = strVal(field2);
|
name2 = strVal(field2);
|
||||||
|
|
||||||
/* Whole-row reference? */
|
/* Whole-row reference? */
|
||||||
@ -1264,7 +1259,6 @@ resolve_column_ref(ParseState *pstate, PLpgSQL_expr *expr,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert(IsA(field3, String));
|
|
||||||
name3 = strVal(field3);
|
name3 = strVal(field3);
|
||||||
colname = name3;
|
colname = name3;
|
||||||
nnames_field = 2;
|
nnames_field = 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user