You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Make sure all the column privs for new user is empty.
196
-
tk.MustQuery(`SELECT * FROM mysql.Columns_priv WHERE User="testCol" and host="localhost" and db="test" and Table_name="test3" and Column_name="c1"`).Check(testkit.Rows())
197
-
tk.MustQuery(`SELECT * FROM mysql.Columns_priv WHERE User="testCol" and host="localhost" and db="test" and Table_name="test3" and Column_name="c2"`).Check(testkit.Rows())
259
+
// Make sure all the column privs for new user is empty.
260
+
tk.MustQuery(`SELECT * FROM mysql.Columns_priv WHERE User="testCol" and host="localhost" and db="test" and Table_name="test3" and Column_name="c1"`).Check(testkit.Rows())
261
+
tk.MustQuery(`SELECT * FROM mysql.Columns_priv WHERE User="testCol" and host="localhost" and db="test" and Table_name="test3" and Column_name="c2"`).Check(testkit.Rows())
198
262
199
-
// Grant each priv to the user.
200
-
for_, v:=rangemysql.AllColumnPrivs {
201
-
sql:=fmt.Sprintf("GRANT %s(c1) ON test.test3 TO 'testCol'@'localhost';", mysql.Priv2Str[v])
202
-
tk.MustExec(sql)
203
-
rows:=tk.MustQuery(`SELECT Column_priv FROM mysql.Columns_priv WHERE User="testCol" and host="localhost" and db="test" and Table_name="test3" and Column_name="c1";`).Rows()
sql:=fmt.Sprintf("GRANT %s(c1) ON test.test3 TO 'testCol'@'localhost';", mysql.Priv2Str[v])
266
+
tk.MustExec(sql)
267
+
rows:=tk.MustQuery(`SELECT Column_priv FROM mysql.Columns_priv WHERE User="testCol" and host="localhost" and db="test" and Table_name="test3" and Column_name="c1";`).Rows()
createUserSQL=`CREATE USER 'testCol1'@'localhost' IDENTIFIED BY '123';`
213
-
tk.MustExec(createUserSQL)
214
-
tk.MustExec("USE test;")
215
-
// Grant all column scope privs.
216
-
tk.MustExec("GRANT ALL(c2) ON test3 TO 'testCol1'@'localhost';")
217
-
// Make sure all the column privs for granted user are in the Column_priv set.
218
-
for_, v:=rangemysql.AllColumnPrivs {
219
-
rows:=tk.MustQuery(`SELECT Column_priv FROM mysql.Columns_priv WHERE User="testCol1" and host="localhost" and db="test" and Table_name="test3" and Column_name="c2";`).Rows()
createUserSQL=`CREATE USER 'testCol1'@'localhost' IDENTIFIED BY '123';`
277
+
tk.MustExec(createUserSQL)
278
+
tk.MustExec("USE test;")
279
+
// Grant all column scope privs.
280
+
tk.MustExec("GRANT ALL(c2) ON test3 TO 'testCol1'@'localhost';")
281
+
// Make sure all the column privs for granted user are in the Column_priv set.
282
+
for_, v:=rangemysql.AllColumnPrivs {
283
+
rows:=tk.MustQuery(`SELECT Column_priv FROM mysql.Columns_priv WHERE User="testCol1" and host="localhost" and db="test" and Table_name="test3" and Column_name="c2";`).Rows()
tk.MustGetErrMsg("GRANT SUPER(c2) ON test3 TO 'testCol1'@'localhost';",
292
+
"[executor:1221]Incorrect usage of COLUMN GRANT and NON-COLUMN PRIVILEGES")
293
+
})
294
+
295
+
t.Run("case-insensitive schema-name with new collation disabled", func(t*testing.T) {
296
+
tk:=newCollationDisabledBootstrapTestKit(t)
297
+
298
+
tk.MustExec(`DROP USER IF EXISTS 'testColCaseSchema'@'%'`)
299
+
tk.MustExec(`CREATE USER 'testColCaseSchema'@'%' IDENTIFIED BY '123'`)
300
+
tk.MustExec(`DROP TABLE IF EXISTS test.issue68406_grant_col`)
301
+
tk.MustExec(`CREATE TABLE test.issue68406_grant_col(id int, name int)`)
226
302
227
-
tk.MustGetErrMsg("GRANT SUPER(c2) ON test3 TO 'testCol1'@'localhost';",
228
-
"[executor:1221]Incorrect usage of COLUMN GRANT and NON-COLUMN PRIVILEGES")
303
+
tk.MustExec(`GRANT SELECT(id) ON TEST.issue68406_grant_col TO 'testColCaseSchema'@'%'`)
304
+
tk.MustExec(`GRANT INSERT(id), UPDATE(name) ON test.issue68406_grant_col TO 'testColCaseSchema'@'%'`)
305
+
tk.MustQuery(`SELECT DB, Table_name, Column_name, Column_priv FROM mysql.columns_priv WHERE User='testColCaseSchema' AND Host='%' ORDER BY DB, Table_name, Column_name`).
0 commit comments