Re: Suspicious strcmp() in src/backend/parser/parse_expr.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Rikard Falkeborn <rikard(dot)falkeborn(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Suspicious strcmp() in src/backend/parser/parse_expr.c
Date: 2019-04-11 02:19:46
Message-ID: 20190411021946.GG2728@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Apr 10, 2019 at 06:43:32PM -0400, Tom Lane wrote:
> Indeed. Considering how much I hate using strcmp's result as a boolean,
> you'd think I'd have got that right. Thanks for noticing!

Just a note about those strcmp() calls using a boolean as return
result in the tree:
src/backend/commands/lockcmds.c: (!strcmp(rte->eref->aliasname, "old")
|| !strcmp(rte->eref->aliasname, "new")))
src/test/modules/test_rls_hooks/test_rls_hooks.c: if
(strcmp(RelationGetRelationName(relation), "rls_test_permissive")
src/test/modules/test_rls_hooks/test_rls_hooks.c: &&
strcmp(RelationGetRelationName(relation), "rls_test_both"))
src/test/modules/test_rls_hooks/test_rls_hooks.c: if
(strcmp(RelationGetRelationName(relation), "rls_test_restrictive")
src/test/modules/test_rls_hooks/test_rls_hooks.c: &&
strcmp(RelationGetRelationName(relation), "rls_test_both"))

Would it be worth changing these as well?
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-04-11 03:07:12 Re: BUG #15734: Walsender process crashing when executing SHOW ALL;
Previous Message Tom Lane 2019-04-10 22:43:32 Re: Suspicious strcmp() in src/backend/parser/parse_expr.c