Indexes on partitioned tables and foreign partitions
От
Arseny Sher
Тема
Indexes on partitioned tables and foreign partitions
Дата
Msg-id
87sh71cakz.fsf@ars-thinkpad
Список
Дерево обсуждения
Indexes on partitioned tables and foreign partitions Arseny Sher <a.sher@postgrespro.ru>
Re: Indexes on partitioned tables and foreign partitions Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Re: Indexes on partitioned tables and foreign partitions Simon Riggs <simon@2ndquadrant.com>
Re: Indexes on partitioned tables and foreign partitions Arseny Sher <a.sher@postgrespro.ru>
Re: Indexes on partitioned tables and foreign partitions Simon Riggs <simon@2ndquadrant.com>
Re: Indexes on partitioned tables and foreign partitions Arseny Sher <a.sher@postgrespro.ru>
Re: Indexes on partitioned tables and foreign partitions Robert Haas <robertmhaas@gmail.com>
Re: Indexes on partitioned tables and foreign partitions Tom Lane <tgl@sss.pgh.pa.us>
Re: Indexes on partitioned tables and foreign partitions Michael Paquier <michael@paquier.xyz>
Re: Indexes on partitioned tables and foreign partitions Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: Indexes on partitioned tables and foreign partitions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Indexes on partitioned tables and foreign partitions Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: Indexes on partitioned tables and foreign partitions Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Re: Indexes on partitioned tables and foreign partitions Simon Riggs <simon@2ndquadrant.com>
Re: Indexes on partitioned tables and foreign partitions Robert Haas <robertmhaas@gmail.com>
Re: Indexes on partitioned tables and foreign partitions Simon Riggs <simon@2ndquadrant.com>
Re: Indexes on partitioned tables and foreign partitions Robert Haas <robertmhaas@gmail.com>
Re: Indexes on partitioned tables and foreign partitions Simon Riggs <simon@2ndquadrant.com>
Re: Indexes on partitioned tables and foreign partitions Robert Haas <robertmhaas@gmail.com>
Re: Indexes on partitioned tables and foreign partitions Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: Indexes on partitioned tables and foreign partitions Michael Paquier <michael@paquier.xyz>
Re: Indexes on partitioned tables and foreign partitions Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: Indexes on partitioned tables and foreign partitions Robert Haas <robertmhaas@gmail.com>
Re: Indexes on partitioned tables and foreign partitions Simon Riggs <simon@2ndquadrant.com>
Re: Indexes on partitioned tables and foreign partitions Robert Haas <robertmhaas@gmail.com>
Hi,
8b08f7d4 added propagation of indexes on partitioned tables to
partitions, which is very cool. However, index creation also recurses
down to foreign tables. I doubt this is intentional, as such indexes are
forbidden as not making much sense; attempt to create index on
partitioned table with foreign partition leads to an error
now. Attached lines fix this.
*** a/src/backend/commands/indexcmds.c
--- b/src/backend/commands/indexcmds.c
*************** DefineIndex(Oid relationId,
*** 915,920 ****
--- 915,926 ----
int maplen;
childrel = heap_open(childRelid, lockmode);
+ /* Foreign table doesn't need indexes */
+ if (childrel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
+ {
+ heap_close(childrel, NoLock);
+ continue;
+ }
childidxs = RelationGetIndexList(childrel);
attmap =
convert_tuples_by_name_map(RelationGetDescr(childrel),
*** a/src/backend/commands/tablecmds.c
--- b/src/backend/commands/tablecmds.c
*************** AttachPartitionEnsureIndexes(Relation re
*** 14352,14357 ****
--- 14352,14361 ----
MemoryContext cxt;
MemoryContext oldcxt;
+ /* Foreign table doesn't need indexes */
+ if (attachrel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
+ return;
+
cxt = AllocSetContextCreate(CurrentMemoryContext,
"AttachPartitionEnsureIndexes",
ALLOCSET_DEFAULT_SIZES);
--
Arseny Sher
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
В списке pgsql-hackers по дате отправления
От: Oleksandr Shulgin
Дата:
От: Etsuro Fujita
Дата: