Re: create table like: ACCESS METHOD - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: create table like: ACCESS METHOD
Date
Msg-id YSh6YzKSg5qfqdrQ@paquier.xyz
Whole thread Raw
In response to Re: create table like: ACCESS METHOD  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: create table like: ACCESS METHOD  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Tue, Jun 01, 2021 at 02:10:45PM -0500, Justin Pryzby wrote:
> rebased and alphabetized

+   /* ACCESS METHOD doesn't apply and isn't copied for partitioned tables */
+   if ((table_like_clause->options & CREATE_TABLE_LIKE_ACCESS_METHOD) != 0 &&
+       !cxt->ispartitioned)
+       cxt->accessMethod = get_am_name(relation->rd_rel->relam);
I was thinking about an ERROR here, but all the other options do the
work when specified only if required, so that's fine.  We should have
a test with a partitioned table and the clause specified, though.

+         <para>
+          The table's access method will be copied.  By default, the
+          <literal>default_table_access_method</literal> is used.
+         </para>
Why is there any need to mention default_table_access_method?  This
just inherits the AM from the source table, which has nothing to do
with the default directly.

+CREATE ACCESS METHOD heapdup TYPE TABLE HANDLER heap_tableam_handler;
+CREATE TABLE likeam() USING heapdup;
+CREATE TABLE likeamlike(LIKE likeam INCLUDING ALL);
Rather than creating a custom AM in this test path, I would be
tempted to move that to create_am.sql.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Failure of subscription tests with topminnow
Next
From: Julien Rouhaud
Date:
Subject: Re: [PATCH] Disable bgworkers during servers start in pg_upgrade