From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Robert Haas <rhaas(at)postgresql(dot)org>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [COMMITTERS] pgsql: Implement table partitioning. |
Date: | 2017-10-18 15:27:41 |
Message-ID: | 20171018152741.n3nobjv2ecz5y6p5@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2017-10-18 16:35:13 | Re: [COMMITTERS] pgsql: Implement table partitioning. |
Previous Message | Alvaro Herrera | 2017-10-18 11:35:39 | pgsql: Make OWNER TO subcommand mention consistent |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2017-10-18 15:46:57 | Re: BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much |
Previous Message | Julien Rouhaud | 2017-10-18 13:20:06 | Re: 64-bit queryId? |