Search in sources :

Example 1 with Revoke

use of com.facebook.presto.sql.tree.Revoke in project presto by prestodb.

the class TestSqlParser method testRevoke.

@Test
public void testRevoke() {
    assertStatement("REVOKE INSERT, DELETE ON t FROM u", new Revoke(false, Optional.of(ImmutableList.of("INSERT", "DELETE")), false, QualifiedName.of("t"), new PrincipalSpecification(PrincipalSpecification.Type.UNSPECIFIED, new Identifier("u"))));
    assertStatement("REVOKE GRANT OPTION FOR SELECT ON t FROM ROLE PUBLIC", new Revoke(true, Optional.of(ImmutableList.of("SELECT")), false, QualifiedName.of("t"), new PrincipalSpecification(PrincipalSpecification.Type.ROLE, new Identifier("PUBLIC"))));
    assertStatement("REVOKE ALL PRIVILEGES ON TABLE t FROM USER u", new Revoke(false, Optional.empty(), true, QualifiedName.of("t"), new PrincipalSpecification(PrincipalSpecification.Type.USER, new Identifier("u"))));
    assertStatement("REVOKE taco ON TABLE \"t\" FROM \"u\"", new Revoke(false, Optional.of(ImmutableList.of("taco")), true, QualifiedName.of("t"), new PrincipalSpecification(PrincipalSpecification.Type.UNSPECIFIED, new Identifier("u"))));
}
Also used : Identifier(com.facebook.presto.sql.tree.Identifier) QueryUtil.quotedIdentifier(com.facebook.presto.sql.QueryUtil.quotedIdentifier) Revoke(com.facebook.presto.sql.tree.Revoke) PrincipalSpecification(com.facebook.presto.sql.tree.PrincipalSpecification) Test(org.testng.annotations.Test)

Aggregations

QueryUtil.quotedIdentifier (com.facebook.presto.sql.QueryUtil.quotedIdentifier)1 Identifier (com.facebook.presto.sql.tree.Identifier)1 PrincipalSpecification (com.facebook.presto.sql.tree.PrincipalSpecification)1 Revoke (com.facebook.presto.sql.tree.Revoke)1 Test (org.testng.annotations.Test)1