Search in sources :

Example 1 with Revoke

use of io.prestosql.sql.tree.Revoke in project hetu-core by openlookeng.

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(io.prestosql.sql.tree.Identifier) QueryUtil.quotedIdentifier(io.prestosql.sql.QueryUtil.quotedIdentifier) Revoke(io.prestosql.sql.tree.Revoke) PrincipalSpecification(io.prestosql.sql.tree.PrincipalSpecification) Test(org.testng.annotations.Test)

Aggregations

QueryUtil.quotedIdentifier (io.prestosql.sql.QueryUtil.quotedIdentifier)1 Identifier (io.prestosql.sql.tree.Identifier)1 PrincipalSpecification (io.prestosql.sql.tree.PrincipalSpecification)1 Revoke (io.prestosql.sql.tree.Revoke)1 Test (org.testng.annotations.Test)1