[MCOL-4687] Insert from view regression Created: 2021-04-20  Updated: 2021-05-17  Resolved: 2021-04-30

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 1.2.5
Fix Version/s: 5.6.1

Type: Bug Priority: Major
Reporter: Todd Stoffel (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: tech_debt

Issue Links:
Issue split
split to MCOL-4702 UPDATE and DELETE using JOINS over VI... Open
split to MCOL-4704 Retest MCOL-4687 (Insert from view) r... Closed
Relates
relates to MCOL-4701 UPDATE and DELETE don't work on view Closed
Sprint: 2021-7

 Description   

Inserting into a Columnstore table from a view used to work in 1.2 and below. A customer noticed that in 5.x and above that it no longer functions. See this example:

CREATE DATABASE monty;
USE monty;
CREATE TABLE foo (id INT, fname VARCHAR(20));
INSERT INTO foo VALUES (1,'Greg');
CREATE VIEW view_foo as SELECT * FROM foo;
SELECT * FROM view_foo;
CREATE TABLE bar (id INT, fname VARCHAR(20)) ENGINE=Columnstore;
INSERT INTO bar SELECT * FROM view_foo;


– ERROR: The storage engine for the table doesn't support IDB-1011: Insert on VIEW is currently not supported.

However, if we use the wrapper trick, it does work:

INSERT INTO bar SELECT * FROM (SELECT * FROM view_foo) t;


– OK: 1 row affected



 Comments   
Comment by Alexander Barkov [ 2021-04-23 ]

Confirmed with the following script:

DROP TABLE IF EXISTS t1,t2;
DROP VIEW IF EXISTS v1;
 
CREATE TABLE t1 (id INT, fname VARCHAR(20)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'Greg');
CREATE VIEW v1 as SELECT * FROM t1;
SELECT * FROM v1;
CREATE TABLE t2 (id INT, fname VARCHAR(20)) ENGINE=Columnstore;
INSERT INTO t2 SELECT * FROM (SELECT * FROM v1) t;
SELECT * FROM t2;

+------+-------+
| id   | fname |
+------+-------+
|    1 | Greg  |
+------+-------+

INSERT INTO t2 SELECT * FROM v1;

ERROR 1178 (42000): The storage engine for the table doesn't support IDB-1011: Insert on VIEW is currently not supported.

Comment by Gregory Dorman (Inactive) [ 2021-04-23 ]

Not new feature. Technical debt. Huge escalation by one of biggest customers. Needs fixing asap.

Comment by Alexander Barkov [ 2021-04-28 ]

UPDATE and DELETE also do not work:

DROP TABLE IF EXISTS t1,t2;
DROP VIEW IF EXISTS v1;
CREATE TABLE t1 (id INT, fname VARCHAR(20)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'Greg');
CREATE VIEW v1 as SELECT * FROM t1;
SELECT * FROM v1;
CREATE TABLE t2 (id INT, fname VARCHAR(20)) ENGINE=Columnstore;
INSERT INTO t2 VALUES (1,'Roman');
UPDATE t2,v1 SET t2.fname=v1.fname WHERE t2.id=v1.id;

ERROR 1178 (42000): The storage engine for the table doesn't support IDB-1011: Update on VIEW is currently not supported.

DELETE t2 FROM t2,v1 WHERE t2.id=v1.id;

ERROR 1178 (42000): The storage engine for the table doesn't support IDB-1011: Delete on VIEW is currently not supported.

Comment by Gagan Goel (Inactive) [ 2021-04-30 ]

For QA: Queries to confirm the issue and verify the fix works are in the issue description.

Comment by Daniel Lee (Inactive) [ 2021-04-30 ]

build tested: 5.6.1 ( Drone #2295 )

Insert test case worked fine now.

As Barkov mentioned, UPDATE and DELETE do not work. Do we plan on fixing them as part of this ticket, or they are out of scope?

Comment by Daniel Lee (Inactive) [ 2021-04-30 ]

UPDATE and DELETE issues are being tracked on MCOL-4701

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