Re: [HACKERS] [COMMITTERS] pgsql: Implement table partitioning.

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [HACKERS] [COMMITTERS] pgsql: Implement table partitioning.
Дата
Msg-id 20171018152741.n3nobjv2ecz5y6p5@alvherre.pgsql
обсуждение исходный текст
Ответы Re: [HACKERS] [COMMITTERS] pgsql: Implement table partitioning.  (Robert Haas <robertmhaas@gmail.com>)
Список 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
temporaryrelation \"%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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: [HACKERS] 64-bit queryId?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] [COMMITTERS] pgsql: Implement table partitioning.