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

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Andrew Gierth <andrew@tao11.riddles.org.uk>, Rikard Falkeborn <rikard.falkeborn@gmail.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-04-11T03:26:31Z
Lists: pgsql-bugs
On Thu, Apr 11, 2019 at 2:20 PM Michael Paquier <michael@paquier.xyz> wrote:
> 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")

Don't look at contrib/spi/refint.c if you value your sanity.

-- 
Thomas Munro
https://enterprisedb.com



Commits

  1. Fix more strcmp() calls using boolean-like comparisons for result checks

  2. Fix backwards test in operator_precedence_warning logic.