‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, June 10, 2020 12:08 PM, Peter Eisentraut 
<peter.eisentr...@2ndquadrant.com> wrote:

> On 2020-06-10 11:42, Georgios wrote:
>
> > 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, ... )`
>
> We already have LIKE INCLUDING STORAGE. Maybe that should just be
> updated to work like what you are asking for.

This is correct. However I do see some limitations there. Consider the valid 
scenario:

`CREATE TABLE target (LIKE source_am1 INCLUDING ALL, LIKE source_am2 INCLUDING 
ALL)`

Which source relation should be used for the access method and storage 
parameters?

Also I _think_ that the current `LIKE` clause specifically targets column 
definitions
in the SQL standard. I am a bit hesitant on the last part, yet this is my
current understanding.

Please, let me know what you think.

>
> ------------------------------------------------------------------------------------------------------------------
>
> Peter Eisentraut http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




Reply via email to