Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions enginetest/enginetests.go
Original file line number Diff line number Diff line change
Expand Up @@ -1809,6 +1809,10 @@ func TestUserPrivileges(t *testing.T, harness ClientHarness) {
}
}

if assertion.Skip {
t.Skipf("Skipping query %s", assertion.Query)
}

user := assertion.User
host := assertion.Host
if user == "" {
Expand Down
14 changes: 14 additions & 0 deletions enginetest/queries/priv_auth_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type UserPrivilegeTestAssertion struct {
Expected []sql.Row
ExpectedErr *errors.Kind
ExpectedErrStr string
Skip bool
}

// QuickPrivilegeTest specifically tests privileges on a predefined user (tester@localhost) using predefined tables and
Expand Down Expand Up @@ -418,6 +419,12 @@ var UserPrivTests = []UserPrivilegeTest{
Query: "SELECT * FROM mydb.test;/*1*/",
ExpectedErr: sql.ErrDatabaseAccessDeniedForUser,
},
{
User: "tester",
Host: "localhost",
Query: "WITH cte AS (SELECT * FROM mydb.test) SELECT * FROM cte;/*1*/",
ExpectedErr: sql.ErrDatabaseAccessDeniedForUser,
},
{
User: "tester",
Host: "localhost",
Expand Down Expand Up @@ -508,6 +515,13 @@ var UserPrivTests = []UserPrivilegeTest{
Query: "SELECT * FROM mydb.test;/*6*/",
Expected: []sql.Row{{1}},
},
{
Skip: true, // CTEs are seen as different tables than underlying table(s).
User: "tester",
Host: "localhost",
Query: "WITH cte AS (SELECT * FROM mydb.test) SELECT * FROM cte;/*6*/",
Expected: []sql.Row{{1}},
},
{
User: "tester",
Host: "localhost",
Expand Down
Loading