[MCOL-4426] CTE Causes Lost Connection Created: 2020-12-01  Updated: 2023-09-22  Resolved: 2023-09-22

Status: Closed
Project: MariaDB ColumnStore
Component/s: MariaDB Server
Affects Version/s: 1.4.4, 1.5.2
Fix Version/s: 23.02.4

Type: Bug Priority: Major
Reporter: Rob Schwyzer Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

https://hub.docker.com/r/mariadb/columnstore for 1.5.2 test. More traditional environment for 1.4 test



 Description   

Performing a CTE on a table when the MariaDB client is not in a database (ex- USE test; if the table(s) being queried reside in `test`- this only occurs when using test.table syntax to refer to a table) causes the query to return ERROR 2013 (HY000): Lost connection to MySQL server during query. The same query performed when a client can refer to just the table as the client is already in the database works without issue.

Setup

CREATE DATABASE tester;
USE tester;
CREATE TABLE `foo` (
  bar int(11) NOT NULL,
  boo varchar(2) NOT NULL
) ENGINE=Columnstore DEFAULT CHARSET=latin1;
exit;

Failure Case Example

Make sure you are not in any database (make sure no USE command has been issued and the client connection did not specify a target database), run the following-

WITH Window AS (SELECT bar, boo FROM tester.foo) SELECT * FROM Window;

Note this is not exclusive to SELECT * and adding a WHERE clause inside the CTE or outside does not improve matters.

Success Case Examples

USE tester;
WITH Window AS (SELECT bar, boo FROM foo) SELECT * FROM Window;
USE mysql;
WITH Window AS (SELECT bar, boo FROM tester.foo) SELECT * FROM Window;

Note the specific database used does not matter, as long as a database is selected this seems to work fine.

Data is Irrelevant

Also note that data appears to be irrelevant. In the test cases given here, no data is present in the tables. For example-

USE tester;
INSERT INTO foo VALUES (10,'a');
INSERT INTO foo VALUES (11,'b');
SELECT * FROM foo;
WITH Window AS (SELECT bar, boo FROM foo) SELECT * FROM Window;
exit;
mysql;
WITH Window AS (SELECT bar, boo FROM tester.foo) SELECT * FROM Window;

Data is correctly returned except when issuing the query without being inside a database.



 Comments   
Comment by Todd Stoffel (Inactive) [ 2023-09-22 ]

dleeyh Can you retest this in latest release and close if appropriate.

Comment by Daniel Lee (Inactive) [ 2023-09-22 ]

It is no longer an issue in the latest release of 23.02.4 and the latest build in the develop branch.

Comment by Daniel Lee (Inactive) [ 2023-09-22 ]

Closed per my last comment.

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