From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | koglep(at)gmail(dot)com |
Subject: | BUG #15069: group by after regexp_replace |
Date: | 2018-02-15 15:14:49 |
Message-ID: | 151870768979.1393.4103488163602755553@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15069
Logged by: Ilhwan Ko
Email address: koglep(at)gmail(dot)com
PostgreSQL version: 9.6.7
Operating system: macOS 10.12
Description:
create table test_t (a varchar(10), b varchar (20), c int);
insert into test_t (a,b,c) values ('a', 'a', 1);
insert into test_t (a,b,c) values (' a', 'a', 2);
insert into test_t (a,b,c) values (' a', 'a', 4);
insert into test_t (a,b,c) values (' a', 'a', 8);
insert into test_t (a,b,c) values ('b', 'b', 1);
insert into test_t (a,b,c) values (' b', 'b', 2);
insert into test_t (a,b,c) values (' b', 'b', 4);
insert into test_t (a,b,c) values (' b', 'b', 8);
select keyword, sum(t.c) as cc
from
(
select upper(regexp_replace(a, '\\s+', '')) as keyword, c
from test_t
) t
group by keyword;
select upper(regexp_replace(a, '\\s+', '')) as keyword, sum(c)
from test_t
group by upper(regexp_replace(a, '\\s+', ''));
select keyword, sum(t.c) as cc
from
(
select upper(regexp_replace(b, '\\s+', '')) as keyword, c
from test_t
) t
group by keyword;
select upper(regexp_replace(b, '\\s+', '')) as keyword, sum(c)
from test_t
group by upper(regexp_replace(b, '\\s+', ''));
I expected to get the same results regarding to above four queries.
However, they were different.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2018-02-15 15:25:12 | Re: BUG #15069: group by after regexp_replace |
Previous Message | David G. Johnston | 2018-02-15 14:48:47 | Re: BUG #15068: PostgreSQL doesn't support queries that involve columns from multiple databases |