CREATE LIKE INCLUDING COMMENTS and STORAGES

Поиск
Список
Период
Сортировка
От Itagaki Takahiro
Тема CREATE LIKE INCLUDING COMMENTS and STORAGES
Дата
Msg-id 20090907114058.C855.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответы Re: CREATE LIKE INCLUDING COMMENTS and STORAGES  (David Fetter <david@fetter.org>)
Re: CREATE LIKE INCLUDING COMMENTS and STORAGES  (Brendan Jurd <direvus@gmail.com>)
Список pgsql-hackers
Here is a patch to implement the following items in our ToDo list:
  * Add CREATE TABLE LIKE ... INCLUDING COMMENTS
  * Have CREATE TABLE LIKE copy column storage parameters

The syntax is:
    CREATE TABLE clone_table (LIKE template_table INCLUDING COMMENTS)
        -- also copy comments on columns.
    CREATE TABLE clone_table (LIKE template_table INCLUDING STORAGES)
        -- also copy storage parameters on columns.

Also, storage parameters of inherited columns are inherited automatically.

There might be room for improvement:

  * Should INCLUDING COMMENTS also copy comments on indexes?
    It copies only comments on columns for now.

  * Should we have additonal syntax to define storage parameters inline
    of CREATE TABLE? For example,
        CREATE TABLE tbl (col text STORAGE MAIN);
    CREATE TABLE fails if there is a conflicted storage parameter for now.
        ERROR:  column "col" has a storage parameter conflict
        DETAIL:  MAIN versus EXTENDED
    but there is no way to resolve the confliction unless we modify the
    definitions of original tables. Meantime, we can overwrite DEFAULTs
    to resolve conflictions by INCLUDING DEFAULTS.

  * Should we have "INCLUDING ALL" as an abbreviated form?
    Many INCLUDING options in CREATE LIKE seems to be messy:
        CREATE TABLE clone_table (LIKE template_table
            INCLUDING DEFAULTS
            INCLUDING CONSTRAINTS
            INCLUDING INDEXES
            INCLUDING STORAGES
            INCLUDING COMMENTS);

Comments welcome.

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

Вложения

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

Предыдущее
От: Itagaki Takahiro
Дата:
Сообщение: Rename StrNCpy to avoid conflictions on win32
Следующее
От: Tom Lane
Дата:
Сообщение: Patch: update Bonjour support to the newer non-deprecated API