Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmE8o-0000YX-M4 for pgsql-sql@arkaria.postgresql.org; Tue, 20 Sep 2016 06:02:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bmE8n-0007HZ-L1 for pgsql-sql@arkaria.postgresql.org; Tue, 20 Sep 2016 06:02:49 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bmE8m-0007Fy-UT for pgsql-sql@postgresql.org; Tue, 20 Sep 2016 06:02:49 +0000 Received: from mxout2.rambler.ru ([81.19.78.101]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmE8k-0006yw-5u for pgsql-sql@postgresql.org; Tue, 20 Sep 2016 06:02:48 +0000 Received: from saddam2.rambler.ru (saddam2.rambler.ru [10.32.16.2]) by mxout2.rambler.ru (Postfix) with ESMTP id 765B08DC046 for ; Tue, 20 Sep 2016 09:02:44 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rambler.ru; s=mail; t=1474351364; bh=4GDWG9Lo6TiO6NJixSSfXeRvl+2bA8Mi3idjZFg2dMo=; h=From:To:Reply-To:Subject:Date; b=iA4zRNPS4pMrP+5xK6gT4pu0yue4W5fwdquQHKa5kfDwd6FkgtWlKK0rj/bHXx1qT jO32djk15Dd2fXVzGIdjYTNjrXGAzPzxDDo5dsYU4WW7dJml3/n1UL8hCr05Obp9zs jbfXhwAWvjVhcdPmK3g9zAokSpuskg53i6qiOSD8= Received: from localhost.localdomain (localhost [127.0.0.1]) by saddam2.rambler.ru (Postfix) with ESMTP id 5C9F435708C2 for ; Tue, 20 Sep 2016 09:02:44 +0300 (MSK) Received: from [193.19.168.163] by mail.rambler.ru with HTTP; Tue, 20 Sep 2016 09:02:44 +0300 From: =?koi8-r?B?4c7E0sXKIOHXwcvJzc/X?= To: pgsql-sql@postgresql.org Reply-To: =?koi8-r?B?4c7E0sXKIOHXwcvJzc/X?= Subject: PostgreSQL 9.5 operator precedence Date: Tue, 20 Sep 2016 09:02:44 +0300 Content-Transfer-Encoding: 7bit Content-Type: multipart/alternative; boundary="_----------=_14743513642932550" Message-Id: <1474351364.271814.29325.2780@mail.rambler.ru> MIME-Version: 1.0 X-Mailer: Rambler WebMail, http://mail.rambler.ru/ X-Rambler-User: aquarius1993@rambler.ru/193.19.168.163 X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org This is a multi-part message in MIME format. --_----------=_14743513642932550 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; format="flowed" Hello, I've got a question about operator precedence is version 9.5 Versions lower than 9.5 worked well with constructions like select a is null =3D b is null (it calculates if a is null, then if b is null and then compare two boolean= s) But now everything is changed, and official 9.5 documentations says that IS operator has lower precedence than =3D operator The thing I don't understand is the error message that I receive: select 1 is null =3D 2 is null; ----------------------------- ERROR: operator does not exist: boolean =3D integer LINE 1: select 1 is null =3D 2 is null ^ HINT: No operator matches the given name and argument type(s). You might ne= ed to add explicit type casts. For me it means that postgres calculated value in the left side of the =3D operator, then it decided not to calculate right side and compare boolean a= nd integer. Why did it not compare null and 2 firstly? Maybe the truth is IS operator and =3D operator has the same precedence, an= d then calculated from left to right? Maybe I miss something? Best Regards, Andrew --_----------=_14743513642932550 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Hello,
I've got a question= about operator precedence is version 9.5

Versions lower than 9.5 worked well = with constructions like
    select a is null =3D b is null
(it calculates if a= is null, then if b is null and then compare two booleans)

But now everything = is changed, and official 9.5 documentations says that
IS operator has lower precede= nce than =3D operator

The thing I don't understand is the error message that I= receive:

    select 1 is null =3D 2 is null;
    -------= ----------------------
    ERROR:  operator does not exist: bool= ean =3D integer
    LINE 1: select 1 is null =3D 2 is null
   &= nbsp;           &nbs= p;             = ^
 &= nbsp;  HINT:  No operator matches the given name and argument typ= e(s). You might need to add explicit type casts.

For me it means that postgres= calculated value in the left side of the =3D operator, then it decided not= to calculate right side and compare boolean and integer.
Why did it not compare nul= l and 2 firstly?
Maybe the truth is IS operator and =3D operator has the same prece= dence, and then calculated from left to right?
Maybe I miss something?
<= br />Best Regards,
Andrew





= --_----------=_14743513642932550--