From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | hisanori(dot)kobayashi(dot)bp(at)nttdata(dot)com |
Subject: | BUG #16501: Incorrect result. select multi_key_columns_range_partition_table |
Date: | 2020-06-18 09:41:44 |
Message-ID: | 16501-5234a9a0394f6754@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: 16501
Logged by: Kobayashi Hisanori
Email address: hisanori(dot)kobayashi(dot)bp(at)nttdata(dot)com
PostgreSQL version: 12.2
Operating system: Windows10
Description:
I found that Incorrect-result sql.
Same for 12.2 and 12.3
I am not good at English, so I will send a reproduction script.
------------------------------
-- ***** execute from psql
--
-- ***** Create Test Table
drop table if exists pt_test02 ;
create table pt_test02
( kbn smallint not null
, nen char(4) not null
, mm char(2) not null
, cd char(3) not null
, val00 numeric(15, 3)
, usr varchar(10)
)
partition by list(kbn) with (oids=false)
;
create table pt_test02_1 partition of pt_test02 for values in
(1) partition by range(nen, mm) with (oids=false) ;
create table pt_test02_1_2019_01 partition of pt_test02_1 for values from
('2019', '01') to ('2019', '07') ;
create table pt_test02_1_2019_02 partition of pt_test02_1 for values from
('2019', '07') to ('2019', '13') ;
create table pt_test02_1_2020_01 partition of pt_test02_1 for values from
('2020', '01') to ('2020', '07') ;
create table pt_test02_1_2020_02 partition of pt_test02_1 for values from
('2020', '07') to ('2020', '13') ;
create table pt_test02_2 partition of pt_test02 for values in
(2) partition by range(nen, mm) with (oids=false) ;
create table pt_test02_2_2019_01 partition of pt_test02_2 for values from
('2019', '01') to ('2019', '07') ;
create table pt_test02_2_2019_02 partition of pt_test02_2 for values from
('2019', '07') to ('2019', '13') ;
create table pt_test02_2_2020_01 partition of pt_test02_2 for values from
('2020', '01') to ('2020', '07') ;
create table pt_test02_2_2020_02 partition of pt_test02_2 for values from
('2020', '07') to ('2020', '13') ;
--
-- ***** Test Data Insert
insert into pt_test02 values(1, '2020', '01', 1, null, null) ;
--
-- ***** Test SQL and result
--
select count(*) from pt_test02 where kbn = 1 and nen <= '2020' and
mm = '01' ;
-- ***** Result = 0 ... incorrect
--
select count(*) from pt_test02_1 where kbn = 1 and nen <= '2020' and
mm = '01' ;
-- ***** Result = 0 ... incorrect
--
select count(*) from pt_test02_1_2020_01 where kbn = 1 and nen <= '2020' and
mm = '01' ;
-- ***** Result = 1 ... correct
--
select count(*) from pt_test02 where kbn = 1 and nen = '2020' and
mm = '01' ;
-- ***** Result = 1 ... correct
------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Etsuro Fujita | 2020-06-18 13:05:12 | Re: BUG #16500: SQL Abend. select multi_key_columns_range_partition_table |
Previous Message | PG Bug reporting form | 2020-06-18 09:35:27 | BUG #16500: SQL Abend. select multi_key_columns_range_partition_table |