Re: Copy storage parameters on CREATE TABLE LIKE/INHERITS

Поиск
Список
Период
Сортировка
От ITAGAKI Takahiro
Тема Re: Copy storage parameters on CREATE TABLE LIKE/INHERITS
Дата
Msg-id 20080801111303.7764.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Re: Copy storage parameters on CREATE TABLE LIKE/INHERITS  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> There are a couple of other things that need to be thought about:
> * LIKE is intended to copy a table as a *portion* of another table;

You're absolutely right. I just thought it's a *better default* behavior
because LIKE and INHERITS are often used in single inheritance, but
in definition they declare columns, not whole tables.
In other words, we don't have an ability of copying tables as units...

However, I think we'd better to have an ability to copy reloptions easily.
There were requests about adding a configuration parameter to modify 
default fillfactor. I think reloption-cloning would be a solution about it.

How about adding a new WITH-LIKE syntax?
CREATE TABLE newtbl ( ... ) WITH (LIKE "template-table")

It is expanded to an option array as below:
SELECT 'WITH (' || array_to_string(         array_append(reloptions, 'OIDS=' || relhasoids), ',') || ')'  FROM pg_class
WHEREoid = "template-table";
 


> I think therefore that having LIKE copy anything "global" to a table,
> such as tablespace or reloptions, is fundamentally wrongheaded.  What
> will you do about conflicts?  The same is true for inheritance cases,
> since a table can inherit from multiple parents.

Currently I uses the first setting found in multiple tables
and directly specified options have the highest priority.
For example, setting are used in order of [A] -> [B] -> [C].
Conflicted parameters are ignored silently for now.
 CREATE TABLE newtbl (LIKE [B], LIKE [C]) WITH ([A])

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Fixing the representation of ORDER BY/GROUP BY/DISTINCT
Следующее
От: Robert Lor
Дата:
Сообщение: Re: Review: DTrace probes (merged version) ver_03