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



Reply via email to