Re: Suspicious strcmp() in src/backend/parser/parse_expr.c - Mailing list pgsql-bugs

From David Rowley
Subject Re: Suspicious strcmp() in src/backend/parser/parse_expr.c
Date
Msg-id CAKJS1f8fvWe8MGsOrPgP5ThJ4QAn5K42a96E-gDffR_Let2tXA@mail.gmail.com
Whole thread Raw
In response to Re: Suspicious strcmp() in src/backend/parser/parse_expr.c  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-bugs
On Thu, 11 Apr 2019 at 15:27, Thomas Munro <thomas.munro@gmail.com> wrote:
>
> 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.

hmm, yeah. Take a non-bool expression, make it into a bool expression,
then compare that to 0 to make it look like a non-bool expression.
Weird.

If we're fixing some, we may as well do them all.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



pgsql-bugs by date:

Previous
From: r.zharkov@postgrespro.ru
Date:
Subject: Re: BUG #15727: PANIC: cannot abort transaction 295144144, it wasalready committed
Next
From: Michael Paquier
Date:
Subject: Re: Suspicious strcmp() in src/backend/parser/parse_expr.c