Lack of possibility to specify CTAS TAM

Started by Kirill Reshkeover 1 year ago7 messages
#1Kirill Reshke
reshkekirill@gmail.com

I have noticed $subj while working with other unrelated patches.
The question is, why there is no CREATE TABLE AS .... USING
(some_access_method)?
This feature looks straightforward, and lack of it is a bit of
inconsistency from my point of view.
Maybe there are some unobvious caveats with implementing it?
I have done a little research reading related threads [1]/messages/by-id/20180703070645.wchpu5muyto5n647@alap3.anarazel.de[2]/messages/by-id/20160812231527.GA690404@alvherre.pgsql, but
these do not address $subj, if i'm not missing anything.
Neither can I find an open CF entry/thread implementing this (Im
looking here http://cfbot.cputube.org/) .

The same storage specification feature can actually be supported for
CTAE (like CTAS but execute) and CREATE MATERIALIZED VIEW.

I can try to propose a POC patch implementing $subj if there are no objections
to having this functionality in the core.

[1]: /messages/by-id/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
[2]: /messages/by-id/20160812231527.GA690404@alvherre.pgsql

#2Andrey M. Borodin
x4mmm@yandex-team.ru
In reply to: Kirill Reshke (#1)
Re: Lack of possibility to specify CTAS TAM

On 31 Jul 2024, at 12:03, Kirill Reshke <reshkekirill@gmail.com> wrote:

CREATE TABLE AS .... USING
(some_access_method)

This looks in a line with usual CREATE TABLE.
+1 for the feature.
Currently we do not have so many TAMs, but I hope eventually we will have some.

Best regards, Andrey Borodin.

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Kirill Reshke (#1)
Re: Lack of possibility to specify CTAS TAM

On Wednesday, July 31, 2024, Kirill Reshke <reshkekirill@gmail.com> wrote:

I have noticed $subj while working with other unrelated patches.
The question is, why there is no CREATE TABLE AS .... USING
(some_access_method)?

The syntax is documented…

CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [
IF NOT EXISTS ] *table_name*
[ (*column_name* [, ...] ) ]
[ USING *method* ]

… AS query

https://www.postgresql.org/docs/current/sql-createtableas.html

David J.

#4Kirill Reshke
reshkekirill@gmail.com
In reply to: Andrey M. Borodin (#2)
Re: Lack of possibility to specify CTAS TAM

On Wed, 31 Jul 2024, 12:12 Andrey M. Borodin, <x4mmm@yandex-team.ru> wrote:

Currently we do not have so many TAMs

Currently we do not have so many TAM in core. Outside core there is
actually a quite a number of projects doing TAMs. Orioledb is one example.

Show quoted text
#5David G. Johnston
david.g.johnston@gmail.com
In reply to: Kirill Reshke (#1)
Re: Lack of possibility to specify CTAS TAM

On Wednesday, July 31, 2024, Kirill Reshke <reshkekirill@gmail.com> wrote:

The same storage specification feature can actually be supported for
CTAE (like CTAS but execute) and CREATE MATERIALIZED VIEW.

On a related note, the description here seems outdated.

https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-DEFAULT-TABLE-ACCESS-METHOD

CMV also has this syntax already; we don’t actually have CTAE presently,
correct?

David J.

#6David G. Johnston
david.g.johnston@gmail.com
In reply to: David G. Johnston (#5)
Re: Lack of possibility to specify CTAS TAM

On Wednesday, July 31, 2024, David G. Johnston <david.g.johnston@gmail.com>
wrote:

On Wednesday, July 31, 2024, Kirill Reshke <reshkekirill@gmail.com> wrote:

The same storage specification feature can actually be supported for
CTAE (like CTAS but execute) and CREATE MATERIALIZED VIEW.

On a related note, the description here seems outdated.

https://www.postgresql.org/docs/current/runtime-config-
client.html#GUC-DEFAULT-TABLE-ACCESS-METHOD

Nevermind, re-reading it I see it is correct. The others are all covered
by “create” while “select into” is called out because of its reliance on
the default.

David J.

#7Kirill Reshke
reshkekirill@gmail.com
In reply to: David G. Johnston (#3)
Re: Lack of possibility to specify CTAS TAM

On Wed, 31 Jul 2024 at 12:15, David G. Johnston
<david.g.johnston@gmail.com> wrote:

On Wednesday, July 31, 2024, Kirill Reshke <reshkekirill@gmail.com> wrote:

I have noticed $subj while working with other unrelated patches.
The question is, why there is no CREATE TABLE AS .... USING
(some_access_method)?

The syntax is documented…

My bad.
Everything is supported in core actually..