Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hELwR-0006tQ-Vd for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Apr 2019 22:43:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hELwO-0006UR-W2 for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Apr 2019 22:43:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hELwO-0006UJ-ON for pgsql-bugs@lists.postgresql.org; Wed, 10 Apr 2019 22:43:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hELwM-0001UT-Kk for pgsql-bugs@lists.postgresql.org; Wed, 10 Apr 2019 22:43:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x3AMhWC0001041; Wed, 10 Apr 2019 18:43:32 -0400 From: Tom Lane To: Andrew Gierth cc: Rikard Falkeborn , pgsql-bugs@lists.postgresql.org Subject: Re: Suspicious strcmp() in src/backend/parser/parse_expr.c In-reply-to: <87pnptwl1a.fsf@news-spur.riddles.org.uk> References: <87pnptwl1a.fsf@news-spur.riddles.org.uk> Comments: In-reply-to Andrew Gierth message dated "Wed, 10 Apr 2019 23:33:35 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1039.1554936212.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 10 Apr 2019 18:43:32 -0400 Message-ID: <1040.1554936212@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andrew Gierth writes: > "Rikard" =3D=3D Rikard Falkeborn writes: > Rikard> if (strcmp(*nodename, "+") =3D=3D 0 || > Rikard> strcmp(*nodename, "-")) // <-- notice the lack of c= omparisson here > Rikard> Should the second part of the || be strcmp(*nodename, "-") =3D=3D= 0? > Yes it should. 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! regards, tom lane