PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16501
PG Version12.2
OSWindows10
Opened2020-06-18 09:41:44+00
Reported byKobayashi Hisanori
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16501
Logged by:          Kobayashi Hisanori
Email address:      (redacted)
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
------------------------------

Messages

DateAuthorSubject
2020-06-18 09:41:44+00PG Bug reporting formBUG #16501: Incorrect result. select multi_key_columns_range_partition_table
2020-06-19 00:00:15+00David RowleyRe: BUG #16501: Incorrect result. select multi_key_columns_range_partition_table
2020-07-15 07:48:29+00Etsuro FujitaRe: BUG #16501: Incorrect result. select multi_key_columns_range_partition_table