From: strahinjak@nordeus.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14385: Operator IS changed priority in 9.5
Date: Thu, 20 Oct 2016 08:50:35 +0000
Message-ID: <20161020085035.1413.58037@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14385
Logged by: Strahinja Kustudic
Email address: strahinjak@nordeus.com
PostgreSQL version: 9.5.4
Operating system: CentOS 6
Description:
If we create a test table like this:
test-# create table test (i integer, b boolean);
And insert the following data:
test-# insert into test (i) values (5), (null);
test-# update test set b = i is not null;
When we run the following select on Postgres 9.1-9.4:
test-# select
test-# 'aaa' || i is not null || 'bbb' as v1,
test-# 'aaa' || b || 'bbb' as v2,
test-# 'aaa' || i is not null || 'bbb' = 'aaa' || b || 'bbb' as v1_eq_v2
test-# from test;
v1 | v2 | v1_eq_v2
-------------+-------------+----------
aaatruebbb | aaatruebbb | t
aaafalsebbb | aaafalsebbb | t
(2 rows)
but if we run the same query on 9.5 we get a different output:
test-# select
test-# 'aaa' || i is not null || 'bbb' as v1,
test-# 'aaa' || b || 'bbb' as v2,
test-# 'aaa' || i is not null || 'bbb' = 'aaa' || b || 'bbb' as v1_eq_v2
test-# from test;
v1 | v2 | v1_eq_v2
----------+-------------+----------
truebbb | aaatruebbb | f
falsebbb | aaafalsebbb | f
(2 rows)
As you can see 9.5 removes the first 'aaa' string from concatenation. We
guess it's because of the operator IS priority has changed in 9.5, because
if we put 'i is not null' between parenthesis, it works like before 9.5:
test-# select
test-# 'aaa' || (i is not null) || 'bbb' as v1,
test-# 'aaa' || b || 'bbb' as v2,
test-# 'aaa' || (i is not null) || 'bbb' = 'aaa' || b || 'bbb' as
v1_eq_v2
test-# from test;
v1 | v2 | v1_eq_v2
-------------+-------------+----------
aaatruebbb | aaatruebbb | t
aaafalsebbb | aaafalsebbb | t
(2 rows)
We couldn't find any documentation changes about this, so is this a bug, or
was it intentional?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: strahinjak@nordeus.com
Subject: Re: BUG #14385: Operator IS changed priority in 9.5
In-Reply-To: <20161020085035.1413.58037@wrigleys.postgresql.org>
References: <20161020085035.1413.58037@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox