Re: Relation wide 'LIKE' clause

From: Georgios <gkokolatos(at)protonmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Relation wide 'LIKE' clause
Date: 2020-06-10 10:17:44
Message-ID: zcD5S3V5vieVI8QBMuhd9Qa9fFOmHFWM6S6YAi7QE_pE_En_yLs9Ldxgt_KJaAcwBQQrUVOnTBLGJDut6E3FRb-pjVNBcR2YbsYA5mRA0p4=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, June 10, 2020 12:08 PM, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-06-10 10:30:26 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Previous Message Peter Eisentraut 2020-06-10 10:08:23 Re: Relation wide 'LIKE' clause