Re: [HACKERS] Default Partition for Range - Mailing list pgsql-hackers
From | Rajkumar Raghuwanshi |
---|---|
Subject | Re: [HACKERS] Default Partition for Range |
Date | |
Msg-id | CAKcux6nsU3zS2OZiiwVq=fetPETkoacu3NTrxKEEBMrX9pVxPw@mail.gmail.com Whole thread Raw |
In response to | Re: [HACKERS] Default Partition for Range (Beena Emerson <memissemerson@gmail.com>) |
Responses |
Re: [HACKERS] Default Partition for Range
|
List | pgsql-hackers |
On Wed, Aug 9, 2017 at 1:54 PM, Beena Emerson <memissemerson@gmail.com> wrote:
Hello Rajkumar,
On Wed, Aug 9, 2017 at 12:37 PM, Rajkumar Raghuwanshi
<rajkumar.raghuwanshi@enterprisedb.com> wrote:
>
> Hi Beena,
>
> I have applied Jeevan's v24 patches and then your v9 patch over commit
> 5ff3d73813ebcc3ff80be77c30b458d728951036.
> and while testing I got a server crash. below is sql to reproduce it.
>
> postgres=# CREATE TABLE rp (a int, b int) PARTITION by range (a);
> CREATE TABLE
> postgres=# CREATE TABLE rp_p1 PARTITION OF rp DEFAULT partition by range(a);
> CREATE TABLE
> postgres=# CREATE TABLE rp_p11 PARTITION OF rp_p1 FOR VALUES FROM (1) TO
> (15);
> CREATE TABLE
> postgres=# CREATE TABLE rp_p12 PARTITION OF rp_p1 DEFAULT;
> CREATE TABLE
> postgres=# insert into rp select i,i from generate_series(1,15) i;
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
>
Thank you for testing. It seems I made a mistake in the assert
condition. I have corrected it in this patch.
Thanks Beena, I have tested new patch, crash got fixed now, got two observations, please check if these are expected?
--difference in the description of default partition in case of list vs range
create table lp (a int) partition by list(a);
create table lp_d partition of lp DEFAULT;
postgres=# \d+ lp_d
Table "public.lp_d"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
Partition of: lp DEFAULT
Partition constraint:
create table rp (a int) partition by range(a);
create table rp_d partition of rp DEFAULT;
postgres=# \d+ rp_d
Table "public.rp_d"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
Partition of: rp DEFAULT
Partition constraint: true
--getting warning WARNING: skipped scanning foreign table...which is a partition of default partition...
--when adding new partition after adding default as foreign partition
CREATE EXTENSION postgres_fdw;
CREATE SERVER def_server FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'postgres', port '5432', use_remote_estimate 'true');
CREATE USER MAPPING FOR PUBLIC SERVER def_server;
postgres=# CREATE TABLE frp (a int, b int) PARTITION BY RANGE(a);
CREATE TABLE
postgres=# CREATE TABLE frp_d PARTITION OF frp DEFAULT partition by RANGE(b);
CREATE TABLE
postgres=# CREATE TABLE ffrp_d_d (like frp);
CREATE TABLE
postgres=# CREATE FOREIGN TABLE ftfrp_d_d PARTITION OF frp_d DEFAULT SERVER def_server OPTIONS (TABLE_NAME 'ffrp_d_d');
CREATE FOREIGN TABLE
postgres=# CREATE TABLE frp_p2 PARTITION OF frp FOR VALUES FROM (10) TO (12);
WARNING: skipped scanning foreign table "ftfrp_d_d" which is a partition of default partition "frp_d"
CREATE TABLE
--difference in the description of default partition in case of list vs range
create table lp (a int) partition by list(a);
create table lp_d partition of lp DEFAULT;
postgres=# \d+ lp_d
Table "public.lp_d"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
Partition of: lp DEFAULT
Partition constraint:
create table rp (a int) partition by range(a);
create table rp_d partition of rp DEFAULT;
postgres=# \d+ rp_d
Table "public.rp_d"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
Partition of: rp DEFAULT
Partition constraint: true
--getting warning WARNING: skipped scanning foreign table...which is a partition of default partition...
--when adding new partition after adding default as foreign partition
CREATE EXTENSION postgres_fdw;
CREATE SERVER def_server FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'postgres', port '5432', use_remote_estimate 'true');
CREATE USER MAPPING FOR PUBLIC SERVER def_server;
postgres=# CREATE TABLE frp (a int, b int) PARTITION BY RANGE(a);
CREATE TABLE
postgres=# CREATE TABLE frp_d PARTITION OF frp DEFAULT partition by RANGE(b);
CREATE TABLE
postgres=# CREATE TABLE ffrp_d_d (like frp);
CREATE TABLE
postgres=# CREATE FOREIGN TABLE ftfrp_d_d PARTITION OF frp_d DEFAULT SERVER def_server OPTIONS (TABLE_NAME 'ffrp_d_d');
CREATE FOREIGN TABLE
postgres=# CREATE TABLE frp_p2 PARTITION OF frp FOR VALUES FROM (10) TO (12);
WARNING: skipped scanning foreign table "ftfrp_d_d" which is a partition of default partition "frp_d"
CREATE TABLE
Thanks & Regards,
Rajkumar Raghuwanshi
QMG, EnterpriseDB Corporation
pgsql-hackers by date: