H2数据库'grant role'错误(H2 database 'grant role' error)
我正在使用H2数据库编写一些数据库创建脚本,但无法授予我创建的角色。 我的脚本是:
create user MY_READWRITEUSER password 'MY_READWRITEUSER'; create user MY_OWNER password 'MY_OWNER' admin ; create schema MY_OWNER AUTHORIZATION MY_OWNER; set schema MY_OWNER; create role MY_READ_ROLE; create role MY_RW_ROLE; grant role MY_RW_ROLE to MY_OWNER; grant role MY_RW_ROLE to MY_READWRITEUSER; grant role MY_READ_ROLE to MY_READUSER;但当我点击授权角色时,H2会抱怨:
[Error Code: 42001, SQL State: 42001] Syntax error in SQL statement "GRANT ROLE MY_RW_ROLE[*] TO MY_OWNER "; expected ",, TO"; SQL statement:我没有看到任何语法错误 - 我做错了什么?
H2版本1.4.191
I'm writing some database creation scripts using H2 database but can't grant the roles I create. My script is:
create user MY_READWRITEUSER password 'MY_READWRITEUSER'; create user MY_OWNER password 'MY_OWNER' admin ; create schema MY_OWNER AUTHORIZATION MY_OWNER; set schema MY_OWNER; create role MY_READ_ROLE; create role MY_RW_ROLE; grant role MY_RW_ROLE to MY_OWNER; grant role MY_RW_ROLE to MY_READWRITEUSER; grant role MY_READ_ROLE to MY_READUSER;but when I hit the grant role lines H2 complains:
[Error Code: 42001, SQL State: 42001] Syntax error in SQL statement "GRANT ROLE MY_RW_ROLE[*] TO MY_OWNER "; expected ",, TO"; SQL statement:I don't see any syntax error - what am I doing wrong?
H2 version 1.4.191
最满意答案
通常情况下 - 如果我问的话,我会在几分钟后找出答案。
有语法错误。 这个:
grant role MY_RW_ROLE to MY_OWNER;应该这样说:
grant MY_RW_ROLE to MY_OWNER;Often the case - if I ask on SO I figure out the answer myself minutes later.
There is a syntax error. This:
grant role MY_RW_ROLE to MY_OWNER;should say this:
grant MY_RW_ROLE to MY_OWNER;更多推荐
发布评论