Search in sources :

Example 1 with Grant

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

the class TestSqlParser method testGrant.

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

Aggregations

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