Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support prefix index #85

Open
GaoYusong opened this issue Sep 13, 2024 · 0 comments
Open

Support prefix index #85

GaoYusong opened this issue Sep 13, 2024 · 0 comments

Comments

@GaoYusong
Copy link
Contributor

{
		Name: "Prefix index with same columns as another index",
		SetUpScript: []string{
			"CREATE table t (pk int primary key, col1 varchar(100));",
			"INSERT into t values (1, '100'), (2, '200');",
			"alter table t add unique index idx1 (col1);",
		},
		Assertions: []ScriptTestAssertion{
			{
				Query:    "alter table t add index idx2 (col1(10));",
				Expected: []sql.Row{{types.NewOkResult(0)}},
			},
			{
				Query: "show create table t",
				Expected: []sql.Row{{"t",
					"CREATE TABLE `t` (\n" +
						"  `pk` int NOT NULL,\n" +
						"  `col1` varchar(100),\n" +
						"  PRIMARY KEY (`pk`),\n" +
						"  UNIQUE KEY `idx1` (`col1`),\n" +
						"  KEY `idx2` (`col1`(10))\n" +
						") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
			},
		},
	}
--- FAIL: TestAlterTable (4.95s)
    --- FAIL: TestAlterTable/Prefix_index_with_same_columns_as_another_index (0.03s)
        --- FAIL: TestAlterTable/Prefix_index_with_same_columns_as_another_index/show_create_table_t (0.01s)
            /Users/shannon/code/myduckserver/evaluation.go:726: 
                	Error Trace:	/Users/shannon/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.18.2-0.20240815142344-761713e36043/enginetest/evaluation.go:726
                	            				/Users/shannon/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.18.2-0.20240815142344-761713e36043/enginetest/evaluation.go:357
                	Error:      	Not equal: 
                	            	expected: []sql.Row{sql.Row{"t", "CREATE TABLE `t` (\n  `pk` int NOT NULL,\n  `col1` varchar(100),\n  PRIMARY KEY (`pk`),\n  UNIQUE KEY `idx1` (`col1`),\n  KEY `idx2` (`col1`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}}
                	            	actual  : []sql.Row{sql.Row{"t", "CREATE TABLE `t` (\n  `pk` int NOT NULL,\n  `col1` varchar(100),\n  PRIMARY KEY (`pk`),\n  UNIQUE KEY `idx1` (`col1`),\n  KEY `idx2` (`col1`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}}
                	            	
                	            	Diff:
                	            	--- Expected
                	            	+++ Actual
                	            	@@ -3,3 +3,3 @@
                	            	   (string) (len=1) "t",
                	            	-  (string) (len=205) "CREATE TABLE `t` (\n  `pk` int NOT NULL,\n  `col1` varchar(100),\n  PRIMARY KEY (`pk`),\n  UNIQUE KEY `idx1` (`col1`),\n  KEY `idx2` (`col1`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"
                	            	+  (string) (len=201) "CREATE TABLE `t` (\n  `pk` int NOT NULL,\n  `col1` varchar(100),\n  PRIMARY KEY (`pk`),\n  UNIQUE KEY `idx1` (`col1`),\n  KEY `idx2` (`col1`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"
                	            	  }
                	Test:       	TestAlterTable/Prefix_index_with_same_columns_as_another_index/show_create_table_t
                	Messages:   	Unexpected result for query show create
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant