PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16302
PG Version12.2
OSCentOS 7.7 x64
Opened2020-03-14 14:02:19+00
Reported byZhou Digoal
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16302
Logged by:          Zhou Digoal
Email address:      (redacted)
PostgreSQL version: 12.2
Operating system:   CentOS 7.7 x64
Description:        

hi,
  when i count a partition table with many childs , it's error below:

```
postgres=> select count(*) from p;
ERROR:  54000: too many range table entries
LOCATION:  add_rte_to_flat_rtable, setrefs.c:425
```

regenerate:

```
do language plpgsql $$   
declare  
begin  
drop table if exists p;  
create table p (id int , info text, crt_time timestamp) partition by range
(crt_time);    
create table p2020 partition of p FOR VALUES FROM ('2020-01-01') TO
('2021-01-01') partition by hash (id);    
create table p2021 partition of p FOR VALUES FROM ('2021-01-01') TO
('2022-01-01') partition by hash (id);    
for i in 0..30000 loop  
  execute format ('create table p2020_%s partition of p2020 FOR VALUES WITH
(MODULUS 65537, REMAINDER %s)', i, i);  
  execute format('alter table p2020_%s set (parallel_workers=52)',i);  
end loop;  
end;  
$$;  

do language plpgsql $$   
declare  
begin  
for i in 30001..60000 loop  
  execute format ('create table p2020_%s partition of p2020 FOR VALUES WITH
(MODULUS 65537, REMAINDER %s)', i, i);  
  execute format('alter table p2020_%s set (parallel_workers=52)',i);  
end loop;  
end;  
$$;  

do language plpgsql $$   
declare  
begin  
for i in 60001..65536 loop  
  execute format ('create table p2020_%s partition of p2020 FOR VALUES WITH
(MODULUS 65537, REMAINDER %s)', i, i);  
  execute format('alter table p2020_%s set (parallel_workers=52)',i);  
end loop;  
end;  
$$;  
```

best regards, 
digoal

Messages

DateAuthorSubject
2020-03-14 14:02:19+00PG Bug reporting formBUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-14 15:03:05+00Tom LaneRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-16 02:27:55+00Amit LangoteRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-16 02:38:30+00Tom LaneRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-17 11:42:41+00Robert HaasRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-17 13:48:59+00Tom LaneRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-17 14:33:11+00Robert HaasRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-17 14:42:08+00Tom LaneRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-17 15:04:49+00Robert HaasRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-19 11:04:21+00Peter EisentrautRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-19 13:33:36+00Tom LaneRe: BUG #16302: too many range table entries - when count partition table(65538 childs)
2020-03-20 02:21:53+00Robert HaasRe: BUG #16302: too many range table entries - when count partition table(65538 childs)