Re: behaviour change - default_tablesapce + partition table

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: behaviour change - default_tablesapce + partition table
Дата
Msg-id 0a124c74-010e-17de-da37-eda3bfb5e680@lab.ntt.co.jp
обсуждение исходный текст
Ответ на behaviour change - default_tablesapce + partition table  (Rushabh Lathia <rushabh.lathia@gmail.com>)
Ответы Re: behaviour change - default_tablesapce + partition table  (Rushabh Lathia <rushabh.lathia@gmail.com>)
Список pgsql-hackers
Agree that this behavior change seems unintentional.

On 2019/05/17 12:40, Rushabh Lathia wrote:
> Looking at the commit changes, it seems like at condition when no other
> tablespace is specified, we default the tablespace to the parent partitioned
> table's.
> 
>     else if (stmt->partbound)
>     {
>         /*
>          * For partitions, when no other tablespace is specified, we default
>          * the tablespace to the parent partitioned table's.
>          */
>         Assert(list_length(inheritOids) == 1);
>         tablespaceId = get_rel_tablespace(linitial_oid(inheritOids));
>     }
> 
> But here it doesn't consider the default_tablespace if the parent
> partitioned
> tablespace is an InvalidOid (which was the care before this commit).
> 
> PFA patch to fix the same.

+
+        if (!OidIsValid(tablespaceId))
+            tablespaceId = GetDefaultTablespace(stmt->relation->relpersistence,
partitioned);
     }
     else
         tablespaceId = GetDefaultTablespace(stmt->relation->relpersistence,

Why not change it like this instead:

@@ -681,7 +681,8 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid
ownerId,
         Assert(list_length(inheritOids) == 1);
         tablespaceId = get_rel_tablespace(linitial_oid(inheritOids));
     }
-    else
+
+    if (!OidIsValid(tablespaceId))
         tablespaceId = GetDefaultTablespace(stmt->relation->relpersistence,
                                             partitioned);

Thanks,
Amit




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

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: Re: jsonpath
Следующее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Re: shared-memory based stats collector