pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14385: Operator IS changed priority in 9.5
2+ messages / 2 participants
[nested] [flat]
* BUG #14385: Operator IS changed priority in 9.5
@ 2016-10-20 08:50 strahinjak@nordeus.com
0 siblings, 0 replies; 2+ messages in thread
From: strahinjak@nordeus.com @ 2016-10-20 08:50 UTC (permalink / raw)
To: pgsql-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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #14385: Operator IS changed priority in 9.5
@ 2016-10-20 09:12 Strahinja Kustudić <strahinjak@nordeus.com>
0 siblings, 0 replies; 2+ messages in thread
From: Strahinja Kustudić @ 2016-10-20 09:12 UTC (permalink / raw)
To: pgsql-bugs
You can ignore this bug, since it's not a bug. We found it in the official
documentation https://www.postgresql.org/docs/9.5/static/release-9-5.html
once we reported it.
At first we thought it was a bug with the '||' operator, so we couldn't
find it in the documentation, then while we were reporting it we realized
it is a change in operator precedence. We mostly checked the
https://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9.5 for new
changes, but in there it wasn't mention.
Sorry about this and thanks for the operator_precedence_warning, it will
help a lot.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-10-20 09:12 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 08:50 BUG #14385: Operator IS changed priority in 9.5 strahinjak@nordeus.com
2016-10-20 09:12 Re: BUG #14385: Operator IS changed priority in 9.5 Strahinja Kustudić <strahinjak@nordeus.com>
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