Indexes on partitioned tables and foreign partitions
От | Arseny Sher |
---|---|
Тема | Indexes on partitioned tables and foreign partitions |
Дата | |
Msg-id | 87sh71cakz.fsf@ars-thinkpad обсуждение исходный текст |
Ответы |
Re: Indexes on partitioned tables and foreign partitions
Re: Indexes on partitioned tables and foreign partitions |
Список | pgsql-hackers |
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 по дате отправления: