Relation wide 'LIKE' clause

Поиск
Список
Период
Сортировка
От Georgios
Тема Relation wide 'LIKE' clause
Дата
Msg-id SLskGbTKe5ED2GWROv1jH-GZFthYD2XXvkFAcx_IL-QxBRiS_XnmqBC7ohnzu5U0-s876eebwteHXNNfyDLKGNzQlpa9E8ZebiwgP1l8n2M=@protonmail.com
обсуждение исходный текст
Ответы Re: Relation wide 'LIKE' clause  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
Hi,

Postgres create table statement supports `LIKE source_table [like_option... ]`
to specify `a table from which the new table automatically copies all column
names, their data types, and their not-null constraints.` according to
documentation [1].

I am wondering if a similar clause would make sense to copy relation wide
settings. For example consider a relation created like this:

`CREATE TABLE source_table ([column, ...]) USING customam WITH (storage_parameter1 = value1, ... )`

Maybe a statement similar to:

`CREATE TABLE target LIKE source_table`

which should be equivalent to:

`CREATE TABLE target (LIKE source_table INCLUDING ALL) USING customam WITH (storage_parameter1 = value1, ...)`

can be usefull as a syntactic shortcut. Maybe the usefulness of such sortcut
becomes a bit more apparent if one considers that custom access methods can
offer a diversity of storage parameters that interact both at relation and
column level, especially when the source relation is column oriented.

If the possibility for such a statment is not discarded, a patch can be readily
provided.

Cheers,
//Georgios

[1] https://www.postgresql.org/docs/13/sql-createtable.html




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

Предыдущее
От: John Naylor
Дата:
Сообщение: typos in comments referring to macros
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: typos in comments referring to macros