Giter VIP home page Giter VIP logo

Comments (6)

timsehn avatar timsehn commented on June 10, 2024

We can probably easily make the syntax a no-op. Would that work for you?

from go-mysql-server.

xocasdashdash avatar xocasdashdash commented on June 10, 2024

Yes! That would be good!

These statements run as part of our migrations so it's needed for us.

I think there was another example of a MySQL partition query failing. I'll update the issue tomorrow

from go-mysql-server.

xocasdashdash avatar xocasdashdash commented on June 10, 2024

ok the other statement that we have issues with is when you specify the algorithm when a table is modified. In the example i shared would be sql2

and this kind of statement:

ALTER TABLE Test MODIFY b_key VARCHAR(20) NOT NULL, ALGORITHM=INPLACE, LOCK=NONE;

from go-mysql-server.

jycor avatar jycor commented on June 10, 2024

Hey @xocasdashdash thanks for reporting this issue.

This PR, dolthub/vitess#340, should properly parse the create table ... query you mentioned.
It's currently in review, and should be merged soon.

Heads up, the create table ... query parses in MySQL, but throws

ERROR: 1492: For RANGE partitions each partition must be defined

It'll still be a no-op in dolt/gms right now, but may eventually change to match MySQL.

I'm currently looking into adding parser support for the alter table ... query.

from go-mysql-server.

xocasdashdash avatar xocasdashdash commented on June 10, 2024

Hey @xocasdashdash thanks for reporting this issue.

This PR, dolthub/vitess#340, should properly parse the create table ... query you mentioned. It's currently in review, and should be merged soon.

Heads up, the create table ... query parses in MySQL, but throws

ERROR: 1492: For RANGE partitions each partition must be defined

It'll still be a no-op in dolt/gms right now, but may eventually change to match MySQL.

I'm currently looking into adding parser support for the alter table ... query.

Ahh thanks so much, yeah we actually have the full range defined.

Here's an example:

CREATE TABLE `t` (
   `t_key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
   `created_at` datetime,
   PRIMARY KEY (`t_key`, `created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
	PARTITION BY RANGE (MONTH(`created_at`)) (
		PARTITION p1 VALUES LESS THAN (2),
        PARTITION p2 VALUES LESS THAN (3),
        PARTITION p3 VALUES LESS THAN (4),
        PARTITION p4 VALUES LESS THAN (5),
        PARTITION p5 VALUES LESS THAN (6),
        PARTITION p6 VALUES LESS THAN (7),
        PARTITION p7 VALUES LESS THAN (8),
        PARTITION p8 VALUES LESS THAN (9),
        PARTITION p9 VALUES LESS THAN (10),
        PARTITION p10 VALUES LESS THAN (11),
        PARTITION p11 VALUES LESS THAN (12),
        PARTITION p12 VALUES LESS THAN (13)
	);
	```
	
Is this going to be supported too?

from go-mysql-server.

jycor avatar jycor commented on June 10, 2024

Yep, that query is already supported in dolt/gms right now!
It is a no-op though

tmp/main*> CREATE TABLE `t` (
        ->     `t_key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
        ->     `created_at` datetime,
        ->     PRIMARY KEY (`t_key`, `created_at`)
        -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
        -> PARTITION BY RANGE (MONTH(`created_at`)) (
        ->     PARTITION p1 VALUES LESS THAN (2),
        ->     PARTITION p2 VALUES LESS THAN (3),
        ->     PARTITION p3 VALUES LESS THAN (4),
        ->     PARTITION p4 VALUES LESS THAN (5),
        ->     PARTITION p5 VALUES LESS THAN (6),
        ->     PARTITION p6 VALUES LESS THAN (7),
        ->     PARTITION p7 VALUES LESS THAN (8),
        ->     PARTITION p8 VALUES LESS THAN (9),
        ->     PARTITION p9 VALUES LESS THAN (10),
        ->     PARTITION p10 VALUES LESS THAN (11),
        ->     PARTITION p11 VALUES LESS THAN (12),
        ->     PARTITION p12 VALUES LESS THAN (13)
        -> );
tmp/main*> show create table t;
+-------+--------------------------------------------------------------------+
| Table | Create Table                                                       |
+-------+--------------------------------------------------------------------+
| t     | CREATE TABLE `t` (                                                 |
|       |   `t_key` varchar(100) NOT NULL,                                   |
|       |   `created_at` datetime NOT NULL,                                  |
|       |   PRIMARY KEY (`t_key`,`created_at`)                               |
|       | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
+-------+--------------------------------------------------------------------+
1 row in set (0.00 sec)

I'm still working on getting the ALTER TABLE... statement parsing.

from go-mysql-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.