Such calls can confuse the reader as strcmp() uses an integer as result.
The places patched here have been spotted by Thomas Munro, David Rowley
and myself.
Author: Michael Paquier
Reviewed-by: David Rowley
Discussion: https://postgr.es/m/
20190411021946.GG2728@paquier.xyz
nv = SPI_getvalue(newtuple, tupdesc, fn);
type = SPI_gettype(tupdesc, fn);
- if ((strcmp(type, "text") && strcmp(type, "varchar") &&
- strcmp(type, "char") && strcmp(type, "bpchar") &&
- strcmp(type, "date") && strcmp(type, "timestamp")) == 0)
+ if (strcmp(type, "text") == 0 ||
+ strcmp(type, "varchar") == 0 ||
+ strcmp(type, "char") == 0 ||
+ strcmp(type, "bpchar") == 0 ||
+ strcmp(type, "date") == 0 ||
+ strcmp(type, "timestamp") == 0)
is_char_type = 1;
#ifdef DEBUG_QUERY
elog(DEBUG4, "check_foreign_key Debug value %s type %s %d",
* skipped.
*/
if (relid == context->viewoid &&
- (!strcmp(rte->eref->aliasname, "old") || !strcmp(rte->eref->aliasname, "new")))
+ (strcmp(rte->eref->aliasname, "old") == 0 ||
+ strcmp(rte->eref->aliasname, "new") == 0))
continue;
/* Currently, we only allow plain tables or views to be locked. */
naffix = 0;
for (i = 0; i < Conf->nspell; i++)
{
- if (i == 0
- || strcmp(Conf->Spell[i]->p.flag, Conf->Spell[i - 1]->p.flag))
+ if (i == 0 ||
+ strcmp(Conf->Spell[i]->p.flag, Conf->Spell[i - 1]->p.flag) != 0)
naffix++;
}
curaffix = -1;
for (i = 0; i < Conf->nspell; i++)
{
- if (i == 0
- || strcmp(Conf->Spell[i]->p.flag, Conf->AffixData[curaffix]))
+ if (i == 0 ||
+ strcmp(Conf->Spell[i]->p.flag, Conf->AffixData[curaffix]) != 0)
{
curaffix++;
Assert(curaffix < naffix);
ParseState *qual_pstate;
RangeTblEntry *rte;
- if (strcmp(RelationGetRelationName(relation), "rls_test_permissive")
- && strcmp(RelationGetRelationName(relation), "rls_test_both"))
+ if (strcmp(RelationGetRelationName(relation), "rls_test_permissive") != 0 &&
+ strcmp(RelationGetRelationName(relation), "rls_test_both") != 0)
return NIL;
qual_pstate = make_parsestate(NULL);
RangeTblEntry *rte;
- if (strcmp(RelationGetRelationName(relation), "rls_test_restrictive")
- && strcmp(RelationGetRelationName(relation), "rls_test_both"))
+ if (strcmp(RelationGetRelationName(relation), "rls_test_restrictive") != 0 &&
+ strcmp(RelationGetRelationName(relation), "rls_test_both") != 0)
return NIL;
qual_pstate = make_parsestate(NULL);