[MCOL-876] Renaming a table in non-current database fails Created: 2017-08-15  Updated: 2018-04-05  Resolved: 2018-02-13

Status: Closed
Project: MariaDB ColumnStore
Component/s: DDLProc
Affects Version/s: 1.0.10
Fix Version/s: 1.2.0

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

Centos 7


Issue Links:
Duplicate
is duplicated by MCOL-1325 rename table fails when database diff... Closed
Relates
relates to MCOL-1208 Support multi-table RENAME TABLE Closed
Epic Link: ColumnStore Compatibility Improvements
Sprint: 2018-03, 2018-04

 Description   

When trying to rename a table in a database that is not active (via USE), rename attempts to use the current database instead. eg:

CREATE TABLE IF NOT EXISTS data.blah (
`EntryID` BIGINT(20) UNSIGNED NOT NULL
) ENGINE=columnstore;

USE test;

RENAME TABLE data.blah TO data.blah2;

generates the error

Internal error: CAL0001: Alter table Failed: IDB-2006: 'test.blah' does not exist in Columnstore.

Effectively ignoring the database name (data in this care) in the Rename table statement.



 Comments   
Comment by David Thompson (Inactive) [ 2017-11-27 ]

confirmed this still is an issue in 1.1.2

Comment by Roman [ 2018-02-01 ]

The RENAME command isn't supported by Columnstore nevertheless there is another DDL command that could be used as a workaround, namely ALTER TABLE test.cs RENAME TO test.test. With this commit that has been already merged I could rename table resides in another schema.

Comment by Roman [ 2018-02-07 ]

Added support for the feature and made this PR.

Comment by Roman [ 2018-02-07 ]

Please take a look at the change. There is one thing mentioned to note. The syntax doesn't support multiply tables rename in one statement since I reused the existing code. But I decided that the whole new infstrastructure: ddl parser tokens and class, grammar changes and ddlproc class - would be an overkill for the feature.

Comment by Andrew Hutchings (Inactive) [ 2018-02-07 ]

Fix looks good and is merged. I'll open a subsequent feature request ticket for multi table rename (not to be implemented for now).

For QA: See tests in pull request for more information.

Comment by Daniel Lee (Inactive) [ 2018-02-13 ]

Build verified: Github source 1.2.0-1

/root/columnstore/mariadb-columnstore-server
commit 960853c58bcfd0b92a48fca6f823e0b43fce17a8
Author: david hill <david.hill@mariadb.com>
Date: Mon Nov 20 20:42:55 2017 -0600

Update README.md

diff --git a/README.md b/README.md
index 1e4a6c6..5d12495 100644
— a/README.md
+++ b/README.md
@@ -273,7 +273,7 @@ apt-get install expect perl openssl file sudo libdbi-perl libboost-all-dev libre
These packages need to be installed:

```bash
-apt-get install expect perl openssl file sudo libdbi-perl libboost-all-dev libreadline-dev rsync net-tools libsnappy1v5
+apt-get install expect perl openssl file sudo libdbi-perl libboost-all-dev libreadline-dev rsync net-tools libsnappy1v5 libreadline5
```

    1. For SUSE 12

/root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine
commit ad2f469811d9bfc989174da13343e72ee2599af2
Merge: 070fc37 7c0086c
Author: Andrew Hutchings <andrew@linuxjedi.co.uk>
Date: Wed Feb 7 10:24:23 2018 +0200

Merge pull request #399 from drrtuy/MCOL-876

MCOL-876. CS now supports RENAME TABLE sql statement.

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