Search in sources :

Example 1 with Grant

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

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

Aggregations

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