Re: Suspicious strcmp() in src/backend/parser/parse_expr.c
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>, Rikard Falkeborn <rikard.falkeborn@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2019-04-11T02:19:46Z
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
Commits
-
Fix more strcmp() calls using boolean-like comparisons for result checks
- d527fda62167 12.0 landed
-
Fix backwards test in operator_precedence_warning logic.
- b9b7fe8ca452 9.5.17 landed
- 62d495395619 9.6.13 landed
- 99bbff5c1579 10.8 landed
- 930930c47663 11.3 landed
- 4cae471d1b6b 12.0 landed