pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Vik Fearing <vik@postgresfriends.org>
To: Justin Pryzby <pryzby@telsasoft.com>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@postgresql.org, Jacob Champion <pchampion@vmware.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Ashwin Agrawal <aagrawal@pivotal.io>
Cc: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Subject: Re: create table like: ACCESS METHOD
Date: Thu, 9 Sep 2021 14:30:51 +0200
Message-ID: <8b530d40-1e85-e3b4-774f-b9cb4e2b7ca2@enterprisedb.com> (raw)
In-Reply-To: <b6102f5b-0753-3f96-071d-5c2b99795159@postgresfriends.org>
References: <20201209201328.GT24052@telsasoft.com>
	<X+WJqu4X4EniF6xT@paquier.xyz>
	<20201229230805.GE25152@telsasoft.com>
	<CANP8+j+UihfCrudMprFaTxXFzGw_1W5yHHFSHpRB7xRigOBeww@mail.gmail.com>
	<20210119210331.GN8560@telsasoft.com>
	<20210323003926.GV4203@telsasoft.com>
	<b6102f5b-0753-3f96-071d-5c2b99795159@postgresfriends.org>

On 27.08.21 12:37, Vik Fearing wrote:
> It seems like this should error to me:
> 
> CREATE ACCESS METHOD heapdup TYPE TABLE HANDLER heap_tableam_handler;
> CREATE TABLE likeam1() USING heap;
> CREATE TABLE likeam2() USING heapdup;
> CREATE TABLE likeamlike(
>      LIKE likeam1 INCLUDING ACCESS METHOD,
>      LIKE likeam2 INCLUDING ACCESS METHOD
> );
> 
> At the very least, the documentation should say that the last one wins.

Hmm.  The problem is that the LIKE clause is really a macro that expands 
to the column definitions of the other table.  So there is, so far, no 
such as thing as two LIKE clauses contradicting.  Whereas the access 
method is a table property.  So I don't think this syntax is the right 
approach for this feature.

You might think about something like

CREATE TABLE t2 (...) USING (LIKE t1);

At least in terms of how the syntax should be structured.





view thread (14+ messages)  latest in thread

Message-ID: <8b530d40-1e85-e3b4-774f-b9cb4e2b7ca2@enterprisedb.com>
Permalink:  ../8b530d40-1e85-e3b4-774f-b9cb4e2b7ca2@enterprisedb.com/
Also on:    postgresql.org/message-id/8b530d40-1e85-e3b4-774f-b9cb4e2b7ca2@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, vik@postgresfriends.org, pryzby@telsasoft.com, simon@2ndquadrant.com, michael@paquier.xyz, pchampion@vmware.com, hlinnaka@iki.fi, aagrawal@pivotal.io, ashu.coek88@gmail.com, andres@anarazel.de, robertmhaas@gmail.com, amit.kapila16@gmail.com, alvherre@alvh.no-ip.org
  Subject: Re: create table like: ACCESS METHOD
  In-Reply-To: <8b530d40-1e85-e3b4-774f-b9cb4e2b7ca2@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox