[MCOL-1577] ColumnStore to allow CREATE TABLE table_name LIKE ... Syntax Created: 2018-07-20  Updated: 2020-08-25  Resolved: 2018-09-11

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 1.1.6
Fix Version/s: 1.2.0

Type: New Feature Priority: Major
Reporter: Chris Calender (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Sprint: 2018-15, 2018-16, 2018-17

 Description   

It would be nice if ColumnStore supported the CREATE TABLE table_name LIKE ... syntax.

For instance, if you try to execute this CREATE TABLE command:

CREATE TABLE table2 LIKE table1;

It throws the following error:

The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types.

Here is the CREATE TABLE for the existing table, table1:

CREATE TABLE `table1` (
`col1` int(10) NOT NULL,
`col2` varchar(255) DEFAULT NULL,
`col3` tinyint(127) DEFAULT NULL,
`col4` tinyint(1) DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=utf8;



 Comments   
Comment by Ravi Prakash (Inactive) [ 2018-08-17 ]

Thing to notice is that source table can only be a columnstore table and hence only need to process supported syntax. I am using an already existing routine to extract the default values for a column and it generates an optional bracket for the current user function and hence the grammar was extended to allow this optional syntax.

Comment by Daniel Lee (Inactive) [ 2018-09-11 ]

Build verified:1.2.0-1 source
/root/columnstore/mariadb-columnstore-server
commit c2052269ef995332eedbef4fbd3ecc4a5e8e8cf0
Merge: b8fded1 d0385eb
Author: benthompson15 <ben.thompson@mariadb.com>
Date: Mon Sep 10 09:07:03 2018 -0500
Merge pull request #131 from mariadb-corporation/build_fix
Revert "MDEV-11036 Add link wsrep_sst_rsync_wan -> wsrep_sst_rsync"
/root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine
commit 764090ba0cf0bbb99092f5bfd9f8014464a136b1
Merge: 73b45ac 5b682a5
Author: Andrew Hutchings <andrew@linuxjedi.co.uk>
Date: Mon Sep 3 16:20:47 2018 +0100
Merge pull request #552 from drrtuy/MCOL-1510_4
MCOL-1510: Add CalpontSelectExecutionPlan::serialize() changes.

The source can also be Innodb tables, or other engines that the server already support. This change adds the support for the ColumnStore engine.

Verified

1) syntax, on both InnoDB and ColumnStore tables
2) desc <tablename>
3) show create table <tablename>
4) entries in systable and syscolumn tables
5) tested table with all supported data types: datatypetestm table.
6) loaded data and execute queries
7) other DDL and DML statements

Generated at Thu Feb 08 02:29:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.