From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: digoal@126.com
Subject: BUG #16302: too many range table entries - when count partition table(65538 childs)
Date: Sat, 14 Mar 2020 14:02:19 +0000
Message-ID: <16302-e45634e2c0e34e97@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16302
Logged by: Zhou Digoal
Email address: digoal@126.com
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, digoal@126.com
Subject: Re: BUG #16302: too many range table entries - when count partition table(65538 childs)
In-Reply-To: <16302-e45634e2c0e34e97@postgresql.org>
References: <16302-e45634e2c0e34e97@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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