From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Robert Haas <rhaas@postgresql.org>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Implement table partitioning.
Date: Wed, 18 Oct 2017 17:27:41 +0200
Message-ID: <20171018152741.n3nobjv2ecz5y6p5@alvherre.pgsql> (raw)
In-Reply-To: <E1cEgoz-0001H4-UP@gemulon.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
This check is odd (tablecmds.c ATExecAttachPartition line 13861):
/* Temp parent cannot have a partition that is itself not a temp */
if (rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP &&
attachrel->rd_rel->relpersistence != RELPERSISTENCE_TEMP)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("cannot attach a permanent relation as partition of temporary relation \"%s\"",
RelationGetRelationName(rel))));
This seems to work (i.e. it's allowed to create a temp partition on a
permanent parent and not vice-versa, which you'd think makes sense) but
it's illusory, because if two sessions try to create temp partitions for
overlapping values, the second session fails with a silly error message.
To be more precise, do this in one session:
CREATE TABLE p (a int, b int) PARTITION BY RANGE (a);
CREATE TEMP TABLE p1 PARTITION OF p FOR VALUES FROM (0) TO (10);
then without closing that one, in another session repeat the second
command:
alvherre=# CREATE TEMP TABLE p1 PARTITION OF p FOR VALUES FROM (0) TO (10);
ERROR: partition "p1" would overlap partition "p1"
which is not what I would have expected.
Maybe there are combinations of different persistence values that can be
allowed to differ (an unlogged partition is probably OK with a permanent
parent), but I don't think the current check is good enough.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org, rhaas@postgresql.org, Langote_Amit_f8@lab.ntt.co.jp, pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Implement table partitioning.
In-Reply-To: <20171018152741.n3nobjv2ecz5y6p5@alvherre.pgsql>
References: <E1cEgoz-0001H4-UP@gemulon.postgresql.org> <20171018152741.n3nobjv2ecz5y6p5@alvherre.pgsql>
* 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